0
votes

I am deploying VNET before deploying other resources. It does deploy the first VNET template, but gives an error deploying others, as it says subnet is is provisioning state i.e. the resource is updating.

I am using nested templates and tried using dependsOn property in the ARM, although is not working. Is is possible to use it at the resource level?

"resources": [
    {
      "apiVersion": "2017-05-10",
      "name": "vNet_ResourceUnit",
      "type": "Microsoft.Resources/deployments",
      "resourceGroup": "[resourceGroup().name]",
      "properties": {
        "mode": "Incremental",
        "templateLink": {
          "uri": "[variables('vnetTemplateUrl')]",
          "contentVersion": "1.0.0.0"
        },
        "parameters": {
          "hyphenBasedPrefix": {
            "value": "[variables('hyphenBasedPrefix')]"
          },
          "baseTemplateUrl": {
            "value": "[parameters('baseTemplateUrl')]"
          },
          "vnetObject": {
            "value": "[variables('vnet')]"
          }
        }
      }
    },
    {
      "apiversion": "2017-05-10",
      "name": "keyVault_resourceunit",
      "type": "microsoft.resources/deployments",
      "resourcegroup": "[resourcegroup().name]",
      "dependsOn": [
        ------
      ],
      "properties": {
        "mode": "incremental",
        "templatelink": {
          "uri": "[variables('keyVaultTemplateUrl')]",
          "contentversion": "1.0.0.0"
        },
        "parameters": {
          "hyphenbasedprefix": {
            "value": "[variables('hyphenbasedprefix')]"
          },
          "basetemplateurl": {
            "value": "[parameters('basetemplateurl')]"
          },
          "keyvaultobject": {
            "value": "[variables('keyvault')]"
          },
          "vnetObject": {
            "value": "[variables('vnet')]"
          }
        }
      }
    }
  ]

How can i use the dependsOn property here at resource level? I did try at the last template using :

"[resourceId('Microsoft.Network/virtualNetworks', parameters('vnetName'))]"

But its not working. How can i use it in the 'keyVault_resourceunit' itself?

1

1 Answers

1
votes

you need to wait for the deployment to finish, not the resources inside the deployment (because they are in a different deployment, template doesnt know anything about them).

"[resourceId('Microsoft.Resources/deployments', 'vNet_ResourceUnit')]"