Skip to main content

Creating Federated Credentials in Parallel on One User-Assigned Managed Identity Fails With 409 Conflict

Medium severityMicrosoft Azure About 20 minutes to fix

Overview

Several federated credentials declared on one managed identity deploy in parallel by default, and Azure refuses the overlapping writes with 409 Conflict. Make the writes serial.

At a glance

Symptom
A deployment that adds federated identity credentials to a user-assigned managed identity fails, often the first time a template grows from one credential to…
Likely cause
Federated identity credentials under one user-assigned managed identity have to be written one at a time, and Resource Manager deploys resources in parallel unless…
Impact
The deployment fails and the workloads that need the missing credentials cannot get tokens.
Verification signal
The fix is proven when the redeployment completes and every credential in the template appears exactly once on the identity.
Safe correction
Make every write under the same identity sequential, then redeploy the unchanged credential definitions.
Rollback or recovery
Rolling back means reverting the ordering change and removing only credentials you added in this change.

Azure Resource Manager refuses to write two federated identity credentials under the same user-assigned managed identity at the same moment. When a Bicep file, ARM template, Terraform run or pipeline creates several credentials on one identity at once, Microsoft’s concurrency detection rejects the overlapping writes with HTTP 409 and the error message Conflict, which Microsoft explains as a concurrent write request under the same user-assigned identity being denied. The fix is to create credentials under one parent identity one after another: chain them with dependsOn, deploy a loop with @batchSize(1) in Bicep or "mode": "serial" in ARM, or use the Terraform AzureRM provider 3.40.0 or later. Credentials on different managed identities can still be created in parallel.

Symptom

A deployment that adds federated identity credentials to a user-assigned managed identity fails, often the first time a template grows from one credential to several. A typical case is one credential per Kubernetes service account, per GitHub environment or per branch, all declared in the same file against the same identity. The deployment reports a 409 on one or more Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials resources. A single credential deployed on its own succeeds, which makes the failure look like a flaky platform rather than a template problem.

False Assumption

The natural assumption is that child resources of one parent are independent and safe to create together. Writing the credentials as siblings, each with parent: userAssignedIdentity, looks correct, and nothing in the file hints at a problem. Microsoft documents the opposite for this resource type. By default, all child federated identity credentials in a template are created in parallel, and that parallelism is what triggers the concurrency detection. A valid template is not the same as a deployable one.

Root Cause

Federated identity credentials under one user-assigned managed identity have to be written one at a time, and Resource Manager deploys resources in parallel unless something orders them. Microsoft’s Bicep guidance states that when resources aren’t dependent on each other, Resource Manager deploys them in parallel. A parent property creates a dependency on the identity only, not between the sibling credentials, so they all start together. Microsoft’s considerations page then states that creating multiple federated identity credentials under the same user-assigned managed identity concurrently triggers concurrency detection logic, which causes requests to fail with a 409-conflict HTTP status code. The same applies outside templates: two pipelines, two scripts or a parallel loop writing to the same identity at once can collide.

Terraform users on old providers hit this too. Microsoft notes that Terraform Provider for Azure (Resource Manager) version 3.40.0 creates multiple federated identity credentials sequentially, and that earlier versions can cause pipeline failures when several are created. The provider’s 3.40.0 changelog records the azurerm_federated_identity_credential change that prevents concurrent writes to the parent resource.

Impact

The deployment fails and the workloads that need the missing credentials cannot get tokens. Any credential that lost the race does not exist, so the workload it was meant for cannot exchange its external token for a Microsoft Entra token and cannot reach Azure resources. Credentials that were written before the conflict may already exist, so the identity can be left with a partial set. This is an availability problem, not an exposure: nothing gains extra access. The risk is a rollout that half-works, and a pipeline that someone “fixes” by re-running until it passes.

Diagnosis

Confirm it is a concurrency conflict and not one of the other documented creation errors, which return different codes.

  1. Read the failed operation in the deployment output. Microsoft documents a concurrency failure as HTTP 409 with the error message Conflict, meaning a concurrent write under the same user-assigned identity was denied.
  2. Rule out the look-alikes Microsoft lists. 400 Issuer and subject combination already exists for this Managed Identity. is a duplicate, not a race. 400 Federated identity credentials must have exactly one audience. is a template error. 405 The request format was unexpected: Support for federated identity credentials not enabled. means the identity’s region doesn’t have them enabled; Microsoft lists Malaysia South as unsupported for user-assigned identities. 429 is throttling: create or update requests are limited to 0.25 per second per resource.
  3. List what exists now, which also gives you a backup of the identity’s current trust before you change anything:
    az identity federated-credential list --identity-name <identity> --resource-group <rg> > fic-backup.json
  4. Compare the names in that output with the template. Credentials missing from the list were the ones refused.
  5. Check how the template orders the credentials. Siblings with only parent, a loop with no @batchSize decorator, or an ARM copy loop without "mode": "serial" all deploy in parallel. For Terraform, check the azurerm provider version in the lock file.

Correction

Make every write under the same identity sequential, then redeploy the unchanged credential definitions. Precondition: you hold Contributor or Owner on the identity, which Microsoft lists as the role needed to configure federated identity credentials, and you have saved fic-backup.json. Change only the ordering, not the issuer, subject or audience values, so the change cannot alter what the identity trusts.

  • Bicep loop: add @batchSize(1) above the looped credential resource. Microsoft’s Bicep loop guidance says that for sequential deployment you set the batch size to 1.
  • Separate Bicep resources: give each credential a dependsOn on the previous one, so they form a chain. Microsoft’s considerations page shows this pattern with three credentials, each depending on the one before.
  • ARM copy loop: set "mode": "serial" and "batchSize": 1 in the copy element.
  • Terraform: pin the azurerm provider to 3.40.0 or later.
  • Scripts and pipelines: run az identity federated-credential create calls for one identity in sequence, and stop separate pipelines from writing to the same identity at the same time.

A single CLI call looks like this, with --audiences defaulting to api://AzureADTokenExchange if you omit it:

az identity federated-credential create --name <fic-name> --identity-name <identity> --resource-group <rg> --issuer <issuer-url> --subject <subject> --audiences api://AzureADTokenExchange

Stop and escalate if the redeployment returns 409 again after the change: something else is writing to the identity at the same time.

Validation

The fix is proven when the redeployment completes and every credential in the template appears exactly once on the identity.

  1. Re-run az identity federated-credential list --identity-name <identity> --resource-group <rg> and check that each expected name is present with the intended issuer, subject and audience.
  2. Check one credential in detail with az identity federated-credential show --name <fic-name> --identity-name <identity> --resource-group <rg>. Values must match the external token case-sensitively, and a wrong subject is accepted at creation without error, so a successful deployment alone doesn’t prove the trust works.
  3. Wait a short time before testing a workload. Microsoft documents that a token request soon after configuration can fail with AADSTS70021: No matching federated identity record found for presented assertion. while the credential propagates. Then run the workload and confirm it gets a token.
  4. Compare the new list with fic-backup.json. Only the credentials the template meant to add should differ.

Rollback

Rolling back means reverting the ordering change and removing only credentials you added in this change. The ordering change touches no trust, so reverting the template commit is safe on its own. If a credential added in this change is wrong or not wanted, remove only that one with az identity federated-credential delete --name <fic-name> --identity-name <identity> --resource-group <rg>, then compare az identity federated-credential list with fic-backup.json. Never delete a credential that was in the backup: a workload depending on it would lose access to Azure. To recreate a credential removed by mistake, run create again with the issuer, subject and audience recorded in the backup, then wait for propagation.

Prevention

Serial Writes Checklist for One Managed Identity

Before merging a change that adds federated identity credentials, confirm that every write to the same identity is ordered, the deployment shows no 409, and az identity federated-credential list matches the template. If a 409 remains, stop re-running the pipeline and find the second writer: retries hide the race rather than remove it.

3

Apply the safer control

Before you change production

Confirm the affected scope, export the current configuration, and test the replacement control in a non-production environment first.

Fix commands and configuration

409
Conflict
dependsOn
4

When to escalate

Validation and rollback are covered in the sections above.

Escalate

Escalate when the blast radius is uncertain, the control cannot be tested safely, or remediation requires an outage or security exception.

The KBY Brief

Fixed? Get the next one before it hits you: The KBY Brief

Practical fixes for the systems you run, by email about twice a week. Unsubscribe at any time.

About this page

Credited to

Dates

Published

Corrections

No corrections are listed for this page. Some review sweeps corrected pages without naming each one; those are in the corrections log.

Was this useful?

Reports go to the site owner and are used to correct pages. Corrections are listed at /corrections.

After remediation

Further reading stays below the corrective workflow and is selected by platform, category and shared technical keywords.

Discover more

Connected KBY resources