Sitecore Azure deployment fails due to the frequency of sending requests to Microsoft Azure services


Description

When performing a regular deployment to an Editing or Delivery Farm using the Sitecore Azure module, the deployment process may occasionally fail with the following error:

TestDevEusCd01Role01PSc266Production [P] Deploy failed System.ApplicationException: TestDevEusCd01Role01PSc266Production [P] Deploy failed --->
System.ApplicationException: Deploy is failed ---> System.Net.WebException: REST REQUEST FAILED :
Request: https://management.core.windows.net/3776474d-7d8e-4bda-9984-b1bfbcd98198/operations/c9182fbb0b87016f932f7324ae98824a Server response = TooManyRequestsToo many requests received. Retry after some time. --->
System.Net.WebException: The remote server returned an error: (503) Server Unavailable.
  at Sitecore.Azure.Managers.HttpGatewayManager.GetHttpResponse(String uri, String httpMethod, String versionXMsVersion, String body)
--- End of inner exception stack trace ---

  at Sitecore.Azure.Managers.HttpGatewayManager.GetHttpResponse(String uri, String httpMethod, String versionXMsVersion, String body)
  at Sitecore.Azure.Providers.AzureProvider.GetAsyncOperationStatus(String subscriptionID, String requestID)
  at Sitecore.Azure.Providers.AzureProvider.CheckAsyncOperationStatus(String requestID, String subscriptionId)
  at Sitecore.Azure.Providers.AzureHost.AzureHostProvider.CreateDeployment(String uniqueDeploymentName, String deploymentLabel, String subscriptionID, String hostedServiceName, String deploymentSlot, String packageUrl, String serviceConfigurationXML)
  at Sitecore.Azure.Managers.AzureManagers.AzureHostManager.DeployPackage(AzureDeployment deployment, String containerName, String file)
  at Sitecore.Azure.Pipelines.DeployAndRun.Azure.Deploy.Action(RolePipelineArgsBase arguments)
  at Sitecore.Azure.Pipelines.BasePipeline.RolePipelineProcessor.Process(RolePipelineArgsBase args)

--- End of inner exception stack trace ---

The cause of this error is the Sitecore Azure module sending too many requests to the Microsoft Azure services through the Service Management REST API. Microsoft Azure could reject the Get Operation Status REST API calls when they are executed too frequently.

This issue affects Azure Module 3.0 - 7.2 versions.

Solution

To resolve the issue, please follow these instructions:

  1. Download one of the following Sitecore patches:
  2. Place the Sitecore.Support.418278.dll assembly into the /bin directory of your web site.
  3. Place the Sitecore.Support.418278.config file into the /App_Config/Include directory.
  4. Use the Azure.OperationStatus.Interval setting to increase the operation status interval: 
    <setting name="Azure.OperationStatus.Interval" value="1000" />
    Note: by default, the Sitecore Azure module runs at the interval set to 100 milliseconds. These instructions suggest setting a 1000 milliseconds interval.