Categories
Azure

AZ quota exhausted, bad config in Bicep

I’m experiencing issues again with deploying App Services to Azure’s data center in West Europe. In December 2023, I saw a similar issue with DSv5 availability. As of August 9, 2024, I’m stuck with what appears to be capacity issues again. However, it turns out that was not the case.

{
    "code": "DeploymentFailed",
    "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": [
        {
            "code": "Unauthorized",
            "message": "Operation cannot be completed without additional AZ quota. Please file a support ticket to request a limit increase. \r\nAdditional details - Location: West Europe \r\nCurrent Limit (Premium0V3 VMs): 0. \r\nCurrent Usage: 0. \r\nAmount required for this deployment (Premium0V3 VMs): 1. \r\n(Minimum) New Limit that you should request to enable this deployment: 1. \r\nNote that if you experience multiple scaling operations failing (in addition to this one) and need to accommodate the aggregate quota requirements of these operations, you will need to request a higher quota limit than the one currently displayed."
        }
    ]
}

Initially, I assumed a problem with the quota. I tested also with other SKU.

{
    "code": "DeploymentFailed",
    "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": [
        {
            "code": "Unauthorized",
            "message": "Operation cannot be completed without additional AZ quota. Please file a support ticket to request a limit increase. \r\nAdditional details - Location: West Europe \r\nCurrent Limit (PremiumV2 VMs): 0. \r\nCurrent Usage: 0. \r\nAmount required for this deployment (PremiumV2 VMs): 1. \r\n(Minimum) New Limit that you should request to enable this deployment: 1. \r\nNote that if you experience multiple scaling operations failing (in addition to this one) and need to accommodate the aggregate quota requirements of these operations, you will need to request a higher quota limit than the one currently displayed."
        }
    ]
}

I was also able to reproduce this in portal.azure.com via the UI.

{
    "code": "InvalidTemplateDeployment",
    "details": [
        {
            "code": "Unauthorized",
            "message": "Operation cannot be completed without additional AZ quota. Please file a support ticket to request a limit increase. \r\nAdditional details - Location: West Europe \r\nCurrent Limit (Premium0V3 VMs): 0. \r\nCurrent Usage: 0. \r\nAmount required for this deployment (Premium0V3 VMs): 1. \r\n(Minimum) New Limit that you should request to enable this deployment: 1. \r\nNote that if you experience multiple scaling operations failing (in addition to this one) and need to accommodate the aggregate quota requirements of these operations, you will need to request a higher quota limit than the one currently displayed."
        }
    ],
    "message": "The template deployment 'example1.com-WebApp-Portal-00000000-0000' is not valid according to the validation procedure. The tracking id is 'aa0a000a-0000-00aa-a000-0000000a0aaa'. See inner errors for details."
}

Microsoft Support Case

I raised a Microsoft case to increase the Azure (AZ) quota for my subscription. The immediate feedback was asking me a lot of questions, and then I didn’t hear back from them for multiple days.

After nearly four working days, I closed the case with MS that still did not contain any new feedback, because I had found the reason for my problems.

Unexpected turn of events

As other deployments to the same subscription were successful using the same compute unit (P0v3), I started to become suspicious. The same deployment would still complain about no quota. I started deploying by hand through the portal, which appeared to work.

zoneRedundant

Then it dawned on me. Once I added ZoneRedundant and didn’t select three instances, I saw exactly this misleading quota error.

I had specified to deploy 2 instances, where my if code would set the zone redundancy to True.

resource appHostingPlan 'Microsoft.Web/serverfarms@2022-09-01' = {
  name: appServicePlanName
  location: location
  kind: 'linux'
  tags: resourceTags
  properties: {
    targetWorkerCount: targetWorkerCount
    reserved: true
    zoneRedundant: targetWorkerCount > 1 ? true : false 
  }
  sku: {
    tier: sku
    name: skuCode
  }
  dependsOn: []
}

However, this was wrong because zone redundancy is not supported for less than 3 instances.

https://learn.microsoft.com/en-us/azure/reliability/reliability-app-service?tabs=cli (2024-08-15)

Minimum instance count of three zones is enforced. The platform will enforce this minimum count behind the scenes if you specify an instance count fewer than three.

https://learn.microsoft.com/en-us/azure/reliability/reliability-app-service?tabs=cli (2024-08-15)

This is the problematic line that caused all the issues in the environment with 2 instances. The development environment set to just 1 instance did not make any issues.

zoneRedundant: targetWorkerCount > 1 ? true : false 

Fixing this issue is a matter of hardcoding ‘false’ for smaller apps that don’t need redundancy.

zoneRedundant: false 

Or switching the number from 1 to 2, so that only apps with 3 or more instances are set to True and therefore zone redundant.

zoneRedundant: targetWorkerCount > 2 ? true : false 

In short

The error returned by Microsoft indicates that they do not have a Premium0V3 capacity with 2 instances configured for zone redundancy. If I remove the zone redundancy, the message changes to indicate that I do have capacity for a Premium0V3 configuration with 2 instances, but without zone redundancy. This can be very misleading and difficult to identify.


I hope this can save someone some debugging time, as I would have been happy to stumble across such a post online. I was searching for this error, but also only found entries about capacity issues.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.