1

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? Commented Oct 18, 2019 at 9:45

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

The command New-AzureRmResourceGroupDeployment will not execute without specifying a Resource Group. So yes, I do have a Resource Group to which I deploy to, sometimes I created it from the portal, sometimes I created it from the command new-AzurermResourceGroup. I am not sure if this issue was related to one of them as I didn't look into finding the pattern.
Can you try re-running the command with New-AzureRmResourceGroup with a different ResourceGroup name? It sounds like some provisioning failed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.