← Back to SOC feed Coverage →

Copilot Studio AI Agents - Hard-coded credentials in Topics or Actions

kql MEDIUM Azure-Sentinel
T1552T1078
credential-thefthuntingmicrosoftofficial
This rule was pulled from an open-source repository and enriched with AI. Validate in a test environment before deploying to production.
View original rule at Azure-Sentinel →
Retrieved: 2026-04-21T09:00:00Z · Confidence: medium

Hunt Hypothesis

Adversaries may embed hard-coded credentials in Copilot Studio AI agents to maintain persistent access or exfiltrate data undetected. SOC teams should proactively hunt for this behavior in Azure Sentinel to identify and remediate potential credential exposure and reduce the risk of long-term compromise.

KQL Query

let suspicious_patterns = @"(AKIA[0-9A-Z]{16})|(AIza[0-9A-Za-z_\-]{35})|(xox[baprs]-[0-9a-zA-Z]{10,48})|(ghp_[A-Za-z0-9]{36,59})|(sk_(live|test)_[A-Za-z0-9]{24})|(SG\.[A-Za-z0-9]{22}\.[A-Za-z0-9]{43})|(\d{8}:[\w\-]{35})|(eyJ[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+)|(Authorization\s*:\s*Basic\s+[A-Za-z0-9=:+]+)|([A-Za-z]+:\/\/[^\/\s]+:[^\/\s]+@[^\/\s]+)"; 
AIAgentsInfo 
| where RegistrySource != "A365"
| summarize arg_max(Timestamp, *) by AIAgentId  
| where AgentStatus != "Deleted"  
| mv-expand tool = AgentToolsDetails 
| mv-expand topic = AgentTopicsDetails 
| where isnotempty(tool) and isnotempty(topic) 
| where tool matches regex suspicious_patterns or topic matches regex suspicious_patterns 
| extend SuspiciousMatchTool = tool, SuspiciousMatchTopic = topic 
| project-reorder AgentCreationTime, AIAgentId, AIAgentName, AgentStatus, CreatorAccountUpn, OwnerAccountUpns, SuspiciousMatchTool, SuspiciousMatchTopic 

Analytic Rule Definition

id: 3a5b2c6d-7e8f-9a0b-1c2d-3e4f5a6b7c8d
name: Copilot Studio AI Agents - Hard-coded credentials in Topics or Actions
description: |
  This query identifies Copilot Studio AI agents that contain hard-coded credentials in Topics or Actions. 
  Storing credentials in clear text within agent logic creates a security risk because these secrets can be exposed to unintended users or attackers. 
  If compromised, credentials could allow unauthorized access to external systems, APIs, or sensitive data.
  Recommended Action: Avoid embedding credentials directly in Topics or Actions. Use secure alternatives 
  such as Azure Key Vault with environment variables or enable secured input options for sensitive fields. 
  Regularly audit agents for hard-coded secrets and rotate any exposed credentials immediately.
requiredDataConnectors: []
tactics:
  - CredentialAccess
  - InitialAccess
relevantTechniques:
  - T1552
  - T1078
query: |
  let suspicious_patterns = @"(AKIA[0-9A-Z]{16})|(AIza[0-9A-Za-z_\-]{35})|(xox[baprs]-[0-9a-zA-Z]{10,48})|(ghp_[A-Za-z0-9]{36,59})|(sk_(live|test)_[A-Za-z0-9]{24})|(SG\.[A-Za-z0-9]{22}\.[A-Za-z0-9]{43})|(\d{8}:[\w\-]{35})|(eyJ[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+)|(Authorization\s*:\s*Basic\s+[A-Za-z0-9=:+]+)|([A-Za-z]+:\/\/[^\/\s]+:[^\/\s]+@[^\/\s]+)"; 
  AIAgentsInfo 
  | where RegistrySource != "A365"
  | summarize arg_max(Timestamp, *) by AIAgentId  
  | where AgentStatus != "Deleted"  
  | mv-expand tool = AgentToolsDetails 
  | mv-expand topic = AgentTopicsDetails 
  | where isnotempty(tool) and isnotempty(topic) 
  | where tool matches regex suspicious_patterns or topic matches regex suspicious_patterns 
  | extend SuspiciousMatchTool = tool, SuspiciousMatchTopic = topic 
  | project-reorder AgentCreationTime, AIAgentId, AIAgentName, AgentStatus, CreatorAccountUpn, OwnerAccountUpns, SuspiciousMatchTool, SuspiciousMatchTopic 
entityMappings:
  - entityType: Account
    fieldMappings:
      - identifier: FullName
        columnName: CreatorAccountUpn
  - entityType: Host
    fieldMappings:
      - identifier: HostName
        columnName: AIAgentName
version: 1.0.0

MITRE ATT&CK Context

References

False Positive Guidance

Original source: https://github.com/Azure/Azure-Sentinel/blob/main/Hunting Queries/AI Agents/Copilot Studio Connector/AIAgentsHardCodedCredentials.yaml