Q: The same pipeline and artifact deploy successfully to DEV but PROD returns "AuthorizationFailed". How would you troubleshoot it?
Root-cause triage when an identical deployment artifact and pipeline succeeds in the DEV subscription but throws AuthorizationFailed (The client does not have authorization to perform action) in PROD.
Master cloud-native security and container runtime defense: Prepare with KodeKloud's CKS course with live browser-based terminal sandboxes.
🛠️ Production Runbook & Step-by-Step Resolution
Direct Answer: In enterprise Azure environments, DEV and PROD live in separate Azure Subscriptions with independent Azure DevOps Service Connections and differing Azure Policy guardrails. 'AuthorizationFailed' indicates missing RBAC role assignments or Azure Policy denials.
Identify the Exact Action and Resource URI
Examine the error message details. Azure errors specify the exact missing action (e.g., Microsoft.Web/serverfarms/write) and target scope (resource group or subscription URI).
The client 'sp-azdo-prod' with object id '...' does not have authorization to perform
action 'Microsoft.Web/serverfarms/write' over scope '/subscriptions/.../resourceGroups/rg-prod-app'
Compare Service Principal RBAC Roles Across Subscriptions
Check what role the Service Connection's Service Principal holds in DEV versus PROD. Often DEV granted Contributor at the Subscription root, whereas PROD was scoped to Reader or limited to a specific Resource Group.
az role assignment list --assignee <prod-sp-id> --all --output table
Audit Azure Policy Deny Actions in PROD
Production subscriptions frequently enforce Azure Policy guardrails (e.g., denying non-standard SKUs, requiring specific tags, or disallowing public IPs) that return AuthorizationFailed with a policy violation details block.
- Extract the exact missing action and scope URI from the pipeline error log.
- Compare Service Principal role assignments between DEV and PROD subscriptions.
- Check if PROD Service Principal has Contributor rights on the target Resource Group.
- Inspect Azure Policy compliance logs for automated 'Deny' actions triggered by missing tags or SKUs.
Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:
- Revoking compromised credentials immediately without analyzing forensic audit trails for active exploitation when configuring Pipeline Artifact Deploys Deactivating a compromised access key prevents abuse while preserving forensic identity for CloudTrail investigations to assess blast radius.
- Terminating compromised instances immediately during incident triage without isolating volatile RAM state when configuring Pipeline Artifact Deploys Terminating compromised instances immediately destroys volatile memory evidence (RAM dumps) required to establish intrusion timelines.
-
Injecting plaintext secrets into container environment variables rather than fetching from dynamic secret vaults when configuring Pipeline Artifact Deploys
Container environment variables are visible via
docker inspector Kubernetes API queries, leaking sensitive API tokens to developers. - Failing to enforce automated credential rotation for third-party SaaS integration tokens when configuring Pipeline Artifact Deploys Static long-lived API tokens shared across internal services represent the highest-probability vector for supply-chain credential compromise.