Secrets, Certificates & SecOps Rotation
SecOps runbook for verifying Managed Identities, inspecting TLS certificates, revoking compromised credentials, rotating secrets, and querying audit logs.
When to Use & Blast Radius
Use this runbook during scheduled credential rotations, TLS certificate renewals, suspected secret compromise, or security incident investigations. Rotating session secrets or revoking partner keys invalidates active sessions or interrupts downstream calls until affected Container App revisions restart.
Rotating frontend authentication secrets logs out active users across Storefront and Commerce simultaneously. Revoking Message Broker, Vector Database, or SMTP Relay credentials requires updating CI/CD environment secrets and restarting dependent Container Apps.
Credential Rotation and Revocation Flow
Loading graph...
Pre-Flight Check
Verify Azure CLI context, inspect Key Vault certificates, and confirm Managed Identity assignments:
az account set --subscription "<SUBSCRIPTION_ID>"az keyvault certificate list --vault-name "<KEY_VAULT_NAME>" \ --query "[].{Name:name, Enabled:attributes.enabled, Expires:attributes.expires}" -o tableaz identity list --resource-group "<RESOURCE_GROUP>" \ --query "[].{Name:name, PrincipalId:principalId, ClientId:clientId}" -o tableProcedure
Verify Entra ID Federated Identity Credentials and Managed Identities
Confirm API Gateway, backend services, and AI agent identities have valid Federated Identity Credentials and no unauthorized role assignments:
Terminal window az ad app federated-credential list --id "<ENTRA_APP_OBJECT_ID>" \--query "[].{Name:name, Subject:subject, Audiences:audiences}" -o tableaz role assignment list --resource-group "<RESOURCE_GROUP>" --assignee "<PRINCIPAL_ID>" \--query "[].{Role:roleDefinitionName, Scope:scope}" -o tableInspect and renew Container Apps custom TLS certificates
Check expiration dates on custom domain certificates bound to the Container Apps environment and import renewed certificates from Key Vault:
Terminal window az containerapp env certificate list --name "<ENV_NAME>" --resource-group "<RESOURCE_GROUP>" \--query "[].{Name:name, Subject:properties.subjectName, Expiration:properties.expirationDate}" -o tableRotate external partner credentials in GitHub Environments and redeploy
Generate a new API key or connection string in the external provider (Message Broker, Qdrant Cloud, or SMTP Relay), update the GitHub Environment secret, and roll out updated Container Apps:
Terminal window gh secret set "<SECRET_NAME>" --env "<ENV>" --body "<NEW_SECRET_VALUE>"gh workflow run apphost-cd.yml -f environment="<ENV>" -f clear_cache=falseUpdate Container App secrets directly during emergency revocation
When immediate rotation cannot wait for a full CI/CD run, update the Container App secret and restart the active revision:
Terminal window az containerapp secret set --name "<APP_NAME>" --resource-group "<RESOURCE_GROUP>" \--secrets "<SECRET_KEY>=<NEW_SECRET_VALUE>"az containerapp revision restart --name "<APP_NAME>" --resource-group "<RESOURCE_GROUP>" --revision "<REVISION_NAME>"Query Azure Activity and Entra ID audit logs
Inspect recent control-plane mutations, role assignment changes, and Key Vault secret access:
Terminal window az monitor activity-log list --resource-group "<RESOURCE_GROUP>" --offset 24h \--query "[?level=='Warning' || level=='Error' || contains(operationName.value,'roleAssignments')].{Time:eventTimestamp, Caller:caller, Operation:operationName.localizedValue, Status:status.value}" \-o table
Verification
Confirm all rotated Container Apps are Running with healthy revisions and zero 401/403 authentication errors in Log Analytics:
WORKSPACE_ID=$(az monitor log-analytics workspace list --resource-group "<RESOURCE_GROUP>" --query "[0].customerId" -o tsv)az monitor log-analytics query --workspace "${WORKSPACE_ID}" \ --analytics-query "ContainerAppConsoleLogs_CL | where TimeGenerated > ago(15m) | where Log_s has_any ('401','403','Unauthorized','NOAUTH') | summarize AuthErrors=count() by ContainerAppName_s" \ -o tableExpected output:
(0 rows returned)Rollback / Escape Hatch
If a rotated partner credential breaks connectivity, re-apply the previous active credential (if not yet revoked) via az containerapp secret set and restart the affected revision, or re-run the last known-good CI/CD deployment.
- Compromised external API key (Message Broker, Qdrant Cloud, SMTP): Issue a replacement key in the provider portal first, roll out via Step 3 or Step 4, verify zero auth errors, and then revoke the compromised key in the provider portal.
- Compromised Entra ID application secret or Federated Credential: Delete the compromised credential via
az ad app federated-credential delete --id "<ENTRA_APP_OBJECT_ID>" --federated-credential-id "<CREDENTIAL_ID>", recreate it viaaspire deploy --environment "<ENV>", and restart affected revisions. - Unauthorized RBAC assignment detected in Activity Log: Remove the assignment immediately with
az role assignment delete --assignee "<PRINCIPAL_ID>" --role "<ROLE_NAME>" --scope "<SCOPE>".