Deployment failures: RequestDisallowedByPolicy and Bicep errors

“Azure deployment failed” is a message you’ll see sooner or later if you work with Bicep, ARM templates or pipelines. The outer error rarely tells you what went wrong. All it says is “DeploymentFailed, at least one resource deployment operation failed”, and the real reason sits one level further down.

A deployment can fail at three different moments, and you need a different tool for each. Before Azure sees anything, Bicep may stop you with a compile error. During validation, Azure can refuse the whole template because of policy, quota or invalid values. And during the deployment itself, single resources can fail, which you find out from the deployment operations.

In the lab you’ll deploy a small Bicep file, break it once at compile time and once at deployment time, and practise going straight to the real error both times.

TimeYou needCostBy the end you can
About 40 minutesA free account, the CLI and the Bicep CLI (az bicep install)Nothing: an NSG and a route table are freeRead Bicep errors and warnings, find the failed operation in a deployment, and recognise policy and quota failures

What it is, in one line

A failed deployment hides the real error inside its operations, so you find it by asking which resource failed and why.

In Simple Words

The wedding caterer’s order

Think of a caterer who gets a wedding order for 200 plates of biryani, 200 sweets and 10 tables. That order can go wrong in three places. The clerk can reject the form because a field was left blank (a compile error). The manager can turn it down because the kitchen can’t cook 2,000 plates (validation, quota). Or the kitchen starts cooking and one dish fails because the sweet shop ran out of milk (a resource failing during deployment). When the customer phones, the front desk only says “order failed”, and the useful answer is in the kitchen’s notes about which dish failed and why. In Azure, those notes are the deployment operations.

Engineer's View

Where deployments fail

  • Compile (Bicep): Bicep turns your file into an ARM template. An error such as BCP057 (unknown name) stops it there. Warnings such as BCP035 (missing required property), BCP036 (wrong type) and BCP089 (unknown property, “did you mean”) let the build carry on, but they usually mean Azure will reject the resource later.
  • Validation: before it creates anything, Azure Resource Manager checks the template, your permissions (Lesson 66), Azure Policy (RequestDisallowedByPolicy, Lesson 54) and quotas. An error at this stage means nothing was deployed.
  • Deployment: resources get created in dependency order. If one fails, the whole deployment is marked Failed with the code DeploymentFailed, but the resources already created stay where they are.
  • Deployment operations: there’s one operation per resource, each with its own state and status message, and that’s where the real error code (SecurityRuleInvalidPriority, for example) lives.
  • Quota: if you see OperationNotAllowed with “exceeding approved … Cores quota”, the subscription’s vCPU limit for that family or region is too low. You can check it with az vm list-usage.
  • Incremental mode: it’s normal to fix the file and deploy again with the same name, and resources that are already correct are left alone.

How it works, step by step

What happens when you run az deployment group create with a Bicep file:

Azure deployment failed: the three places a deployment can fail
  1. The CLI runs Bicep to build an ARM template. An error stops things here, while warnings get printed and the build goes on.
  2. The template is sent to Azure Resource Manager, which validates it, checks your rights, evaluates Azure Policy and checks quotas.
  3. ARM creates a deployment and starts one operation per resource, in dependency order.
  4. Each resource provider then accepts or rejects its resource, and a rejection shows up as a failed operation with a specific error.
  5. If any operation failed, ARM marks the whole deployment Failed and hands back the generic DeploymentFailed message.

So make it a habit never to stop at DeploymentFailed. Ask for the failed operations and read their codes, and you’ll save yourself a lot of time.

Deployment error codes by stage

Before you run any command, double-check it

Read every command twice before you press Enter. Check the target: the system or account, the IDs, the names and the sizes. These commands are for learning and were tested in our lab, not on your system. At work, run the read-only list commands first, follow your change process, make sure a backup exists, and ask a second person to check anything that changes or deletes data. You run them at your own risk.

Don’t ignore warnings either. This is what Bicep prints for a simple typo in a security rule, acess instead of access:

main.bicep(14,9) : Warning BCP035: The specified "object" declaration is missing the following required properties: "access". ...
main.bicep(17,11) : Warning BCP089: The property "acess" is not allowed on objects of type "SecurityRulePropertiesFormat". Did you mean "access"? ...

The build succeeds and the deployment starts, then Azure rejects the rule a minute later, when reading the warnings would have caught it in a second.

Check quota before you deploy VMs

Quota failures hurt the most in a release window because nothing you change in the file will fix them. Every subscription has a vCPU limit per region and per VM family, and on a free account those limits are small, so check them before any deployment that adds VMs:

az vm list-usage --location centralindia --query "[?name.value=='cores' || contains(name.value, 'DSv5')].{name:name.localizedValue, used:currentValue, limit:limit}" -o table
Name                          Used    Limit
----------------------------  ------  -------
Total Regional vCPUs          2       10
Standard DSv5 Family vCPUs    0       10

Your numbers will be different. If what’s already used plus what the template adds goes over the limit, the deployment fails with OperationNotAllowed and a message about exceeding the approved quota. You can request an increase in the portal under Quotas, or pick another family or region.

Nested deployments hide one level deeper

Bicep modules turn into nested deployments, so when a module fails, the parent’s failed operation is of type Microsoft.Resources/deployments and its message is DeploymentFailed again. Take the nested deployment’s name from the parent’s targetResource, list its operations, and keep going down until you reach a real resource. A pipeline can do this walk for you and print the deepest error.

Deploy a Bicep file and read its operations

1A small Bicep file

Save this as C:\azure-lab\l67\main.bicep:

@description('Location for all resources')
param location string = resourceGroup().location

@description('Port the app listens on')
param appPort int = 8080

resource nsg 'Microsoft.Network/networkSecurityGroups@2024-05-01' = {
  name: 'nsg-app67'
  location: location
  properties: {
    securityRules: [
      {
        name: 'allow-app'
        properties: {
          priority: 200
          direction: 'Inbound'
          access: 'Allow'
          protocol: 'Tcp'
          sourceAddressPrefix: 'VirtualNetwork'
          sourcePortRange: '*'
          destinationAddressPrefix: '*'
          destinationPortRange: string(appPort)
        }
      }
    ]
  }
}

resource rt 'Microsoft.Network/routeTables@2024-05-01' = {
  name: 'rt-app67'
  location: location
  properties: {
    disableBgpRoutePropagation: true
  }
}

output nsgId string = nsg.id

2Build, preview, deploy

Build it first to see any errors and warnings, then preview with what-if and deploy:

az bicep build --file C:\azure-lab\l67\main.bicep --stdout | Out-Null
az group create --name rg-saat-l67 --location centralindia --tags course=saatvedha-azure lesson=67 -o none
az deployment group what-if --resource-group rg-saat-l67 --template-file C:\azure-lab\l67\main.bicep --result-format ResourceIdOnly
az deployment group create --resource-group rg-saat-l67 --name d67 --template-file C:\azure-lab\l67\main.bicep --query properties.provisioningState -o tsv

You should see something like this:

Resource and property changes are indicated with this symbol:
  + Create

The deployment will update the following scope:

Scope: /subscriptions/.../resourceGroups/rg-saat-l67

  + Microsoft.Network/networkSecurityGroups/nsg-app67
  + Microsoft.Network/routeTables/rt-app67

Resource changes: 2 to create.
Succeeded

3Read the deployment history

Each deployment gets recorded on the resource group:

az deployment group list --resource-group rg-saat-l67 --query "[].{name:name, state:properties.provisioningState, time:properties.timestamp}" -o table
az deployment operation group list --resource-group rg-saat-l67 --name d67 --query "[].{resource:properties.targetResource.resourceName, state:properties.provisioningState}" -o table

You should see something like this:

Name    State      Time
------  ---------  --------------------------------
d67     Succeeded  2026-10-21T07:41:12.123456+00:00
Resource    State
----------  ---------
nsg-app67   Succeeded
rt-app67    Succeeded

You get one operation per resource, and this is the list you’ll be reading whenever something fails.

Azure deployment details with both resources succeeded
Deployment d67: both resources Succeeded.
what-if preview before an Azure deployment
Preview first, then deploy.

✅ Checkpoint: You deployed a Bicep file and can list its deployments and per-resource operations.

Break It, Then Fix It

Keep the resource group, because you’ll use it for both breaks.

1Break it: a typo Bicep catches

Say someone edits the port line and mistypes the parameter name. Change string(appPort) to string(appPortt), then deploy:

(Get-Content C:\azure-lab\l67\main.bicep -Raw) -replace 'string\(appPort\)', 'string(appPortt)' | Set-Content C:\azure-lab\l67\main.bicep
az deployment group create --resource-group rg-saat-l67 --name d67 --template-file C:\azure-lab\l67\main.bicep -o none

You’ll get output like this:

C:\azure-lab\l67\main.bicep(5,7) : Warning no-unused-params: Parameter "appPort" is declared but never used. [https://aka.ms/bicep/linter-diagnostics#no-unused-params]
C:\azure-lab\l67\main.bicep(22,40) : Error BCP057: The name "appPortt" does not exist in the current context. [https://aka.ms/bicep/core-diagnostics#BCP057]

Nothing reached Azure. The error gives you the file, line, column and a code, and the warning above it is a big hint, because the real parameter is now unused. This is the cheapest kind of failure to have, so run az bicep build in your pipeline before every deployment and catch it there.

To fix it, correct the name and build again:

(Get-Content C:\azure-lab\l67\main.bicep -Raw) -replace 'appPortt', 'appPort' | Set-Content C:\azure-lab\l67\main.bicep
az bicep build --file C:\azure-lab\l67\main.bicep --stdout | Out-Null

No errors or warnings are printed.

2Break it: a value Azure rejects

Now a colleague moves the rule “to the end of the list” by giving it priority 5000. Bicep doesn’t know the allowed range, so the build still passes:

(Get-Content C:\azure-lab\l67\main.bicep -Raw) -replace 'priority: 200', 'priority: 5000' | Set-Content C:\azure-lab\l67\main.bicep
az deployment group create --resource-group rg-saat-l67 --name d67 --template-file C:\azure-lab\l67\main.bicep -o none

You’ll get an error like this:

{"status":"Failed","error":{"code":"DeploymentFailed","target":"/subscriptions/.../deployments/d67","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.","details":[...]}}

DeploymentFailed only tells you that something failed, so ask which operation failed and why:

az deployment operation group list --resource-group rg-saat-l67 --name d67 --query "[?properties.provisioningState=='Failed'].{resource:properties.targetResource.resourceName, code:properties.statusMessage.error.code, message:properties.statusMessage.error.message}" -o json

You should see something like this:

[
  {
    "code": "SecurityRuleInvalidPriority",
    "message": "Security rule has invalid Priority. Value provided: 5000 Allowed range 100-4096.",
    "resource": "nsg-app67"
  }
]

The real error is on nsg-app67, because NSG priorities have to be between 100 and 4096. rt-app67 doesn’t appear in the list since it didn’t fail.

To fix it, use a valid priority and redeploy with the same name:

(Get-Content C:\azure-lab\l67\main.bicep -Raw) -replace 'priority: 5000', 'priority: 4000' | Set-Content C:\azure-lab\l67\main.bicep
az deployment group create --resource-group rg-saat-l67 --name d67 --template-file C:\azure-lab\l67\main.bicep --query properties.provisioningState -o tsv

You should see Succeeded.

Failed deployment operation with SecurityRuleInvalidPriority
The operation names the resource and the reason.

You can stop this kind of mistake earlier with a decorator on the parameter or a check in your module, for example @minValue(100) and @maxValue(4096) on a priority parameter, so Bicep refuses the value before anything is sent.

Policy failures don’t behave like this one. A RequestDisallowedByPolicy error comes back during validation, before any resource exists, so there are no failed resource operations to read, and the error itself names the policy assignment (you saw this in Lesson 54). If your pipeline reports a failure but there are no failed operations, look for a policy or quota message in the deployment’s own error first.

3Clean up

Delete the lab resource group:

az group delete --name rg-saat-l67 --yes

✅ Checkpoint: You stopped a compile error before Azure and found a deploy-time error in the deployment operations.

This happened at work

The release that failed at 2 am with “DeploymentFailed”

This was at a healthcare company whose nightly release pipeline deployed 40 resources from one Bicep file. Late one night it failed with DeploymentFailed, and that one line was all the on-call engineer could see in the pipeline log. He re-ran it twice and then rolled back the app release, which had nothing to do with the problem.

Next morning a teammate listed the deployment operations and found it straight away. One VM had failed with OperationNotAllowed, because the new VM size pushed the subscription past its DSv5 family vCPU quota in Central India, and every other resource had succeeded.

What they changed: now, when a deployment fails, the pipeline prints the failed deployment operations on its own. A pre-deployment step checks az vm list-usage against the VM sizes in the template, and quota increases are requested during capacity planning instead of in the middle of an outage.

Common mistakes and troubleshooting

MistakeWhat you seeWhat to do
Stopping at DeploymentFailedNo idea what brokeList failed deployment operations.
Ignoring Bicep warningsResource rejected at deploy timeTreat BCP035, BCP036 and BCP089 as errors.
Not running what-ifSurprise changes or deletionsRun what-if before deploying.
Quota too lowOperationNotAllowed, cores quotaCheck az vm list-usage; request an increase.
Policy denialRequestDisallowedByPolicyRead the assignment in the error (Lesson 54).
Re-running blindlySame failure, wasted timeFix the cause, then redeploy with the same name.

Interview questions

Click a question to open it. Each one is phrased the way an interviewer would ask it, and under it you’ll find why they ask and one way you could answer in your own words.

Fresher level

1. A deployment says DeploymentFailed. What do you do first?

Why they ask this: The basic method.

How you might answer: I’d list the deployment operations and read the error code and message on the resource that failed.

2. Bicep error vs warning?

Why they ask this: Tool knowledge.

How you might answer: An error stops the build, so nothing gets deployed. A warning lets it carry on, but it often means Azure will reject the resource.

3. What is what-if?

Why they ask this: Safety tool.

How you might answer: It’s a preview of what a deployment would change (create, modify, delete or no change) without deploying anything.

2–5 years experience

4. A deployment fails on one VM with OperationNotAllowed. Why?

Why they ask this: A real troubleshooting path.

How you might answer: Most of the time it’s the vCPU quota for that VM family or region. I’d check az vm list-usage and then either pick another size or region or request a quota increase.

5. How do you find which resource failed in a nested deployment?

Why they ask this: Depth.

How you might answer: I list the parent’s operations, find the failed Microsoft.Resources/deployments one, and then list the operations of that nested deployment.

6. What happens to resources that succeeded before a failure?

Why they ask this: ARM behaviour.

How you might answer: They stay. In incremental mode, when you redeploy after the fix, those are left as they are and only the rest get created.

Senior level

7. How would you make a pipeline catch deployment problems early?

Why they ask this: They want a strong pipeline.

How you might answer: I’d run bicep build with warnings treated as errors, add linter rules and a what-if review, check policy compliance and quotas, test-deploy to a sandbox, and have the pipeline print failed operations automatically.

8. How do you handle partial failures in production?

Why they ask this: Operations maturity.

How you might answer: Keep templates idempotent so the same deployment can be rerun after the fix, use deployment stacks for clean-up, and write rollback plans that don’t assume it’s all-or-nothing.

9. How do you avoid quota surprises?

Why they ask this: Capacity planning.

How you might answer: We tracked usage against limits per family and region, alerted when we got close, asked for increases well before a project needed them, and spread workloads across families and regions.

Quick quiz

Q1. Where is the real error for a DeploymentFailed?

  1. The outer message
  2. Deployment operations
  3. Activity log only
  4. Bicep warnings
Show answer

B — Each resource operation has its own error.

Q2. BCP057 means?

  1. Quota exceeded
  2. Unknown name in the Bicep file
  3. Policy denial
  4. Wrong region
Show answer

B — A name doesn’t exist in scope.

Q3. NSG rule priority 5000 fails with?

  1. QuotaExceeded
  2. SecurityRuleInvalidPriority
  3. AuthorizationFailed
  4. Conflict
Show answer

B — Priorities must be 100 to 4096.

Q4. Do Bicep warnings stop the build?

  1. Yes
  2. No
  3. Only in pipelines
  4. Only for VMs
Show answer

B — Warnings print but the build continues.

Q5. Which command checks vCPU quota use?

  1. az quota show-all
  2. az vm list-usage
  3. az deployment what-if
  4. az bicep lint
Show answer

B — It lists usage and limits per family.

Quick recap

You can now take any failed deployment from “DeploymentFailed” to the exact resource and reason in under a minute.

  • Deployments fail at compile, validation or deployment time.
  • Bicep errors stop the build; warnings still matter.
  • DeploymentFailed is a wrapper; read the failed operations.
  • Quota and policy failures happen before resources are created.
  • Fix the cause and redeploy with the same name.

Next lesson

Lesson 68: Throttling and quotas: HTTP 429 and snapshot limits → Here you’ll meet throttling (HTTP 429), snapshot limits and backup tool concurrency, and learn to back off instead of retrying harder.

Further reading: Azure deployment failed

Want to go deeper into Azure deployment failed? See Microsoft’s Find error codes for Azure deployments and Bicep core diagnostics. You can also see the full plan for this course on the Azure Cloud Administration course page.

Scroll to Top

This website uses cookies

We use a few cookies to keep this site working. If you allow it, we also use Google Analytics to count visits so we can improve our lessons. You can accept all, deny the optional ones, or choose what to allow.