Microsoft Foundry Keys or Connection Secrets Accessed by New Principal
Identifies the first time in seven days that a high-privilege Azure principal lists or regenerates the API keys of a Microsoft Foundry (Azure AI Services) account, or reads the stored secrets of a Foundry account or project connection. Account keys grant direct inference access to every model deployment on the account and bypass Entra ID conditional access, and connection secrets hold credentials for downstream services such as Azure OpenAI, storage, and search. A compromised identity retrieving these keys is a common first step in LLMjacking and in pivoting from a Foundry project to the data it is connected to.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2026/10/23"
3integration = ["azure"]
4maturity = "production"
5updated_date = "2026/10/23"
6
7[rule]
8author = ["Elastic"]
9description = """
10Identifies the first time in seven days that a high-privilege Azure principal lists or regenerates the API keys of a
11Microsoft Foundry (Azure AI Services) account, or reads the stored secrets of a Foundry account or project connection.
12Account keys grant direct inference access to every model deployment on the account and bypass Entra ID conditional
13access, and connection secrets hold credentials for downstream services such as Azure OpenAI, storage, and search. A
14compromised identity retrieving these keys is a common first step in LLMjacking and in pivoting from a Foundry project
15to the data it is connected to.
16"""
17false_positives = [
18 """
19 Administrators with Owner or Contributor roles opening the Keys and Endpoint blade in the Azure portal or Foundry
20 portal, which issues a listKeys call. Confirm the activity with the principal and prefer Entra ID authentication
21 over key-based access.
22 """,
23 """
24 Infrastructure-as-code pipelines and deployment scripts that read keys to configure applications. Prefer managed
25 identities, or add exceptions for the service principals that run these pipelines.
26 """,
27]
28from = "now-9m"
29index = ["logs-azure.activitylogs-*"]
30language = "kuery"
31license = "Elastic License v2"
32name = "Microsoft Foundry Keys or Connection Secrets Accessed by New Principal"
33note = """## Triage and analysis
34
35### Investigating Microsoft Foundry Keys or Connection Secrets Accessed by New Principal
36
37Microsoft Foundry accounts (`Microsoft.CognitiveServices/accounts`) expose two API keys that authorize inference against
38every model deployment on the account. Foundry accounts and projects also store connection secrets for linked resources.
39This rule fires when a high-privilege principal that has not done so for that resource in the last seven days lists or
40regenerates account keys, or reads account or project connection secrets.
41
42### Possible investigation steps
43
44- Identify the caller from `azure.activitylogs.identity.authorization.evidence.principal_id`, `user.name`, and
45 `azure.activitylogs.identity.authorization.evidence.principal_type`, and confirm the role in
46 `azure.activitylogs.identity.authorization.evidence.role`.
47- Review `azure.resource.name`, `azure.resource.group`, and `azure.subscription_id` to determine which Foundry account
48 or project was affected and what model deployments or connections it holds.
49- Check `source.ip` and `source.geo.country_name` against the principal's normal sign-in locations, and review Entra ID
50 sign-in logs for the same principal around the event.
51- For `REGENERATEKEY`, determine whether a legitimate key rotation was scheduled. An unplanned regeneration can also be
52 used to lock out legitimate applications.
53- Look for follow-on activity from the same principal, such as deployment or content filter changes, diagnostic setting
54 deletion, or new role assignments on the account.
55
56### False positive analysis
57
58- Portal users with privileged roles viewing keys during setup or troubleshooting. Confirm with the user and their
59 change records.
60- Deployment automation that reads keys on every release. Exclude those service principals by ID.
61
62### Response and remediation
63
64- If the access is not authorized, regenerate both account keys, rotate any connection secrets that were read, and
65 review recent inference usage and cost on the account.
66- Revoke the principal's sessions, reset its credentials, and review its role assignments.
67- Set `disableLocalAuth` on the account to require Entra ID authentication instead of keys where possible.
68"""
69references = [
70 "https://learn.microsoft.com/en-us/azure/ai-services/authentication",
71 "https://learn.microsoft.com/en-us/azure/ai-foundry/how-to/connections-add",
72 "https://www.elastic.co/docs/reference/integrations/azure/activitylogs",
73]
74risk_score = 47
75rule_id = "49796406-78a2-4c11-aa5b-6f1a3ca730de"
76setup = """## Setup
77
78This rule requires Azure Activity Logs ingested via the Azure integration (`azure.activitylogs` data stream). Key
79listing, key regeneration, and connection secret reads are Administrative control-plane events and are logged by
80default.
81"""
82severity = "medium"
83tags = [
84 "Domain: Cloud",
85 "Domain: GenAI",
86 "Data Source: Azure",
87 "Data Source: Azure Activity Logs",
88 "Data Source: Microsoft Foundry",
89 "Platform: Azure",
90 "Use Case: Threat Detection",
91 "Tactic: Credential Access",
92 "Tactic: Initial Access",
93 "Threat: LLMjacking",
94 "Threat: Unauthorized AI Usage",
95 "Mitre Atlas: AML.T0055",
96 "Resources: Investigation Guide",
97 "Rule Type: New Terms",
98]
99timestamp_override = "event.ingested"
100type = "new_terms"
101
102query = '''
103data_stream.dataset: "azure.activitylogs" and
104azure.activitylogs.operation_name: (
105 "MICROSOFT.COGNITIVESERVICES/ACCOUNTS/LISTKEYS/ACTION" or
106 "MICROSOFT.COGNITIVESERVICES/ACCOUNTS/REGENERATEKEY/ACTION" or
107 "MICROSOFT.COGNITIVESERVICES/ACCOUNTS/CONNECTIONS/LISTSECRETS/ACTION" or
108 "MICROSOFT.COGNITIVESERVICES/ACCOUNTS/PROJECTS/CONNECTIONS/LISTSECRETS/ACTION"
109) and
110azure.activitylogs.identity.authorization.evidence.role: (
111 "Owner" or
112 "Contributor" or
113 "Cognitive Services Contributor" or
114 "Cognitive Services OpenAI Contributor" or
115 "User Access Administrator"
116) and event.outcome: "success"
117'''
118
119
120[[rule.threat]]
121framework = "MITRE ATT&CK"
122[[rule.threat.technique]]
123id = "T1555"
124name = "Credentials from Password Stores"
125reference = "https://attack.mitre.org/techniques/T1555/"
126[[rule.threat.technique.subtechnique]]
127id = "T1555.006"
128name = "Cloud Secrets Management Stores"
129reference = "https://attack.mitre.org/techniques/T1555/006/"
130
131
132
133[rule.threat.tactic]
134id = "TA0006"
135name = "Credential Access"
136reference = "https://attack.mitre.org/tactics/TA0006/"
137[[rule.threat]]
138framework = "MITRE ATT&CK"
139[[rule.threat.technique]]
140id = "T1078"
141name = "Valid Accounts"
142reference = "https://attack.mitre.org/techniques/T1078/"
143[[rule.threat.technique.subtechnique]]
144id = "T1078.004"
145name = "Cloud Accounts"
146reference = "https://attack.mitre.org/techniques/T1078/004/"
147
148
149
150[rule.threat.tactic]
151id = "TA0001"
152name = "Initial Access"
153reference = "https://attack.mitre.org/tactics/TA0001/"
154[[rule.threat_mappings]]
155framework = "MITRE ATLAS"
156version = "2026.09"
157[[rule.threat_mappings.threat]]
158framework = "MITRE ATLAS"
159[[rule.threat_mappings.threat.technique]]
160id = "AML.T0055"
161name = "Unsecured Credentials"
162reference = "https://atlas.mitre.org/techniques/AML.T0055/"
163
164
165[rule.threat_mappings.threat.tactic]
166id = "AML.TA0013"
167name = "Credential Access"
168reference = "https://atlas.mitre.org/tactics/AML.TA0013/"
169
170[rule.investigation_fields]
171field_names = [
172 "@timestamp",
173 "azure.activitylogs.operation_name",
174 "azure.activitylogs.identity.authorization.evidence.principal_id",
175 "azure.activitylogs.identity.authorization.evidence.principal_type",
176 "azure.activitylogs.identity.authorization.evidence.role",
177 "user.name",
178 "source.ip",
179 "source.geo.country_name",
180 "azure.resource.name",
181 "azure.resource.group",
182 "azure.subscription_id",
183]
184
185[rule.new_terms]
186field = "new_terms_fields"
187value = ["azure.activitylogs.identity.authorization.evidence.principal_id", "azure.resource.name"]
188[[rule.new_terms.history_window_start]]
189field = "history_window_start"
190value = "now-7d"
Triage and analysis
Investigating Microsoft Foundry Keys or Connection Secrets Accessed by New Principal
Microsoft Foundry accounts (Microsoft.CognitiveServices/accounts) expose two API keys that authorize inference against
every model deployment on the account. Foundry accounts and projects also store connection secrets for linked resources.
This rule fires when a high-privilege principal that has not done so for that resource in the last seven days lists or
regenerates account keys, or reads account or project connection secrets.
Possible investigation steps
- Identify the caller from
azure.activitylogs.identity.authorization.evidence.principal_id,user.name, andazure.activitylogs.identity.authorization.evidence.principal_type, and confirm the role inazure.activitylogs.identity.authorization.evidence.role. - Review
azure.resource.name,azure.resource.group, andazure.subscription_idto determine which Foundry account or project was affected and what model deployments or connections it holds. - Check
source.ipandsource.geo.country_nameagainst the principal's normal sign-in locations, and review Entra ID sign-in logs for the same principal around the event. - For
REGENERATEKEY, determine whether a legitimate key rotation was scheduled. An unplanned regeneration can also be used to lock out legitimate applications. - Look for follow-on activity from the same principal, such as deployment or content filter changes, diagnostic setting deletion, or new role assignments on the account.
False positive analysis
- Portal users with privileged roles viewing keys during setup or troubleshooting. Confirm with the user and their change records.
- Deployment automation that reads keys on every release. Exclude those service principals by ID.
Response and remediation
- If the access is not authorized, regenerate both account keys, rotate any connection secrets that were read, and review recent inference usage and cost on the account.
- Revoke the principal's sessions, reset its credentials, and review its role assignments.
- Set
disableLocalAuthon the account to require Entra ID authentication instead of keys where possible.
References
Related rules
- Azure Arc Cluster Credential Access by Identity from Unusual Source
- AWS Bedrock Model Invocation From High Number of Countries
- AWS Bedrock Model Invocation Impossible Travel
- First Time GCP Vertex AI Inference by Caller from Source ASN
- Microsoft Foundry Content Filter Modified or Deleted