I'm trying to deploy Azure Site Recovery (ASR) infrastructure using Bicep templates in an Azure DevOps pipeline, but I'm facing several issues. In the first pipeline run, resources like fabrics and containers don't get fully provisioned, and I have to re-

nikita tiwari 25 Reputation points
2025-06-26T13:29:05.3033333+00:00

I'm trying to deploy Azure Site Recovery (ASR) infrastructure using Bicep templates in an Azure DevOps pipeline, but I'm facing several issues. In the first pipeline run, resources like fabrics and containers don't get fully provisioned, and I have to re-run the pipeline for the deployment to proceed. I tried upgrading the API versions, but that didn't resolve the issue. Then I split the code into separate Bicep modules to deploy each ASR component independently, but the container mapping module is getting skipped during the pipeline run. To work around this, I attempted to create the container mapping using Azure CLI with correct inputs, but I'm still getting errors. Can someone help identify what's missing or suggest a reliable approach to automate the full ASR deployment end-to-end?

Azure DevOps
{count} votes

1 answer

Sort by: Most helpful
  1. Durga Reshma Malthi 6,605 Reputation points Microsoft External Staff Moderator
    2025-06-27T08:46:15.95+00:00

    Hi nikita tiwari

    Could you please share the YAML file in private message for further debugging

    Meanwhile follow the below steps:

    1. Use dependsOn inn your Bicep modules, explicitly define dependencies using the dependsOn property to ensure that resources are provisioned in the correct order.
    2. Use a deploymentScript resource in Bicep to poll for readiness of fabrics and containers before proceeding to the next module.
    3. Use multiple Azure DevOps pipeline stages or jobs to sequence ASR resource creation and verification.
    4. You can mix Bicep for initial resource provisioning and Azure CLI or REST API for:
      • Checking fabricState
      • Creating container mapping
      • Associating replication policies
      Example:
         az recoveryservices fabric container mapping create \
           --resource-group $rg \
           --vault-name $vault \
           --fabric-name $fabric \
           --container-name $container \
           --name $mappingName \
           --policy-id $policyId
      

    Hope this helps!

    Please Let me know if you have any queries.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.