0
votes

I am trying to provision some resources on Azure using the Azure Resource Manager with a template I have put together; I am provisioning several web apps with independent Service Plans concurrently. Of course each web app resource "dependsOn" its Service plan.

Everyone once in a while when I deploy using Powershell I get the following error:

New-AzureRmResourceGroupDeployment : 4:21:22 PM - Resource Microsoft.Web/serverfarms 'ServicePlanA' failed with message 'Cannot find Web space ExampleResourceGroup-AustraliaEastwebspace for subscription ...'

This fails randomly on one or more of the Service Plans.

I also found this GitHub issue, but since I am not using the CLI I couldn't see how this would help https://github.com/Azure/azure-xplat-cli/issues/1646

I also have the latest AzureRM packages from https://www.powershellgallery.com/packages/AzureRM/

The API version I am using is "2015-08-01", and the schema of the deployment template is https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#

Here is a segment from the template that creates the mentioned resources:

{
            "name": "[variables('WebFrontServicePlanAName')]",
            "type": "Microsoft.Web/serverfarms",
            "location": "[parameters('DataCenterALocation')]",
            "apiVersion": "2015-08-01",
            "dependsOn": [ ],
            "tags": {
                "displayName": "WebFrontServicePlanA"
            },
            "sku": {
                "name": "[parameters('WebFrontServicePlanSKU')]"

            },
            "properties": {
                "name": "[variables('WebFrontServicePlanAName')]",
                "workerSize": "[parameters('WebFrontServicePlanAWorkerSize')]",
                "numberOfWorkers": 1
            }
        },
          ....


          {
            "name": "[variables('webAppName')]",
            "type": "Microsoft.Web/sites",
            "location": "[parameters('DataCenterALocation')]",
            "apiVersion": "2015-08-01",
            "dependsOn": [
                "[concat('Microsoft.Web/serverfarms/', variables('WebFrontServicePlanAName'))]"
            ],
            "tags": {
                "[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', variables('WebFrontServicePlanAName'))]": "Resource",
                "displayName": "webApp"
            },
            "properties": {
                "name": "[variables('webAppName')]",
                "serverFarmId": "[resourceId('Microsoft.Web/serverfarms/', variables('WebFrontServicePlanAName'))]"
            },

        }
1
So, we hit this problem today and I believe it’s something to do with Australia south east region, we changed the region and didn’t face the issue. Have you setup your RG in Australia south east region?Yaser

1 Answers

0
votes

Do you already have an existing resource group that you're deploying to? If not try using the cmdlet New-AzureRmResourceGroupinstead of New-AzureRmResourceGroupDeployment.

In Azure Web Apps, resource groups are backed by webspaces. Thus a resource group may contain multiple webspaces each in a different geo region. If you don't have the resource group, and you're not creating it, then you wouldn't have the corresponding webspace, which would cause the error you're seeing.