Kai*_*ter 3 azure-virtual-network azure-resource-manager azure-rm-template
我想使用这些 vnet/子网部署虚拟网络设置
每个子网都包含在"resources": [...]相应虚拟网络的数组中,并且每个子网都具有 vnet 作为依赖项,如下所示:
{
"apiVersion": "2020-04-01",
"type": "subnets",
"location": "[parameters('location')]",
"name": "ingress",
"dependsOn": [
"[parameters('vnetNameCluster')]"
],
"properties": {
"addressPrefix": "[parameters('subnetPrefixIngress')]"
}
}
Run Code Online (Sandbox Code Playgroud)
然而,在部署虚拟网络时,经常会出现冲突:
{
"error": {
"code": "AnotherOperationInProgress",
"message": "Another operation on this or dependent resource is in progress. To retrieve status of the operation use uri: https://management.azure.com/subscriptions/xxxxxx/providers/Microsoft.Network/locations/westus/operations/yyyyyyyyyyyyyyy?api-version=2020-04-01.",
"details": []
}
}
Run Code Online (Sandbox Code Playgroud)
我可以添加什么依赖项来避免这种冲突?
经过一番尝试和错误后,我通过将虚拟网络中的前一个子网添加为依赖项来避免冲突 - 因此第一个子网仍然只依赖于虚拟网络:
{
"apiVersion": "2020-04-01",
"type": "subnets",
"location": "[parameters('location')]",
"name": "agents",
"dependsOn": [
"[parameters('vnetNameCluster')]",
"[resourceId('Microsoft.Network/virtualNetworks/subnets',parameters('vnetNameCluster'),'ingress')]"
],
Run Code Online (Sandbox Code Playgroud)