Troubleshoot ConstrainedAllocationFailed when deploying a Cloud service (classic) to Azure

Important

Cloud Services (classic) is now deprecated for all customers as of September 1st, 2024. Any existing running deployments will be stopped and shut down by Microsoft and the data will be permanantly lost starting October 2024. New deployments should use the new Azure Resource Manager based deployment model Azure Cloud Services (extended support).

In this article, you troubleshoot allocation failures where Azure Cloud services (classic) can't deploy because of allocation constraints.

When you deploy instances to a Cloud service (classic) or add new web or worker role instances, Azure allocates compute resources.

You may occasionally receive errors during these operations even before you reach the Azure subscription limit.

Tip

The information may also be useful when you plan the deployment of your services.

Symptom

In Azure portal, navigate to your Cloud service (classic) and in the sidebar select Operation log (classic) to view the logs.

Image shows the Operation log (classic) blade.

When you inspect the logs of your Cloud service (classic), you see the following exception:

Exception Type Error Message
ConstrainedAllocationFailed Azure operation '{Operation ID}' failed with code Compute.ConstrainedAllocationFailed. Details: Allocation failed; unable to satisfy constraints in request. The requested new service deployment is bound to an Affinity Group, or it targets a Virtual Network, or there's an existing deployment under this hosted service. Any of these conditions constrains the new deployment to specific Azure resources. Retry later or try reducing the virtual machine (VM) size or number of role instances. Alternatively, if possible, remove the constraints or try deploying to a different region.

Cause

When the first instance is deployed to a Cloud service (in either staging or production), that Cloud service gets pinned to a cluster.

Over time, the resources in this cluster may become fully utilized. If a Cloud service (classic) makes an allocation request for more resources when insufficient resources are available in the pinned cluster, the request results in an allocation failure. For more information, see the allocation failure common issues.

Solution

Existing cloud services are pinned to a cluster. Any further deployments for the Cloud service (classic) happen in the same cluster.

When you experience an allocation error in this scenario, the recommended course of action is to redeploy to a new Cloud service (classic) (and update the CNAME).

Tip

This solution is likely to be most successful as it allows the platform to choose from all clusters in that region.

Note

This solution should incur zero downtime.

  1. Deploy the workload to a new Cloud service (classic).

    Warning

    If you do not want to lose the IP address associated with this deployment slot, you can use Solution 3 - Keep the IP address.

  2. Update the CNAME or A record to point traffic to the new Cloud service (classic).

  3. Once zero traffic is going to the old site, you can delete the old Cloud service (classic).

See Troubleshooting Cloud service (classic) allocation failures | Microsoft Docs for further remediation steps.

Next steps

For more allocation failure solutions and background information:

If your Azure issue isn't addressed in this article, visit the Azure forums on the Microsoft Developer Network (MSDN) and Stack Overflow. You can post your issue in these forums, or post to @AzureSupport on X. You also can submit an Azure support request. To submit a support request, on the Azure support page, select Get support.