Azure / Azure/azure-quickstart-templates

Update subnets with Incremental Deployment

Open
#7,723 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Bicep
Stars
14.9k
Forks
16.2k
Avg merge
6d 21h
Merged PRs (30d)
6

Description

I'm trying to update subnets with below ARM code to update it's private endpoint policy, enable service endpoint and delegate subnet to a service in Incremental mode. However when I run it, it remove the NSG/UDR on the subnets, I'm afraid it is also changing other subnet settings to their default value. How can I deploy this via ARM by only changing the specified configuration.

{
"apiVersion": "2017-05-10",
"name": "updatePrivateEndpointSubnet",
"type": "Microsoft.Resources/deployments",
"resourceGroup": "[parameters('vnetRG')]",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"name": "[concat(parameters('vnetName'), '/', parameters('privateEndpointSubnet'))]",
"id": "[resourceId(parameters('vnetRG'), 'Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('privateEndpointSubnet'))]",
"properties": {
"addressPrefix": "[parameters('privateEndpointSubnetAddressPrefix')]",
"privateEndpointNetworkPolicies": "Disabled",
"privateLinkServiceNetworkPolicies": "Enabled"
},
"type": "Microsoft.Network/virtualNetworks/subnets",
"apiVersion": "2019-09-01"
}
]
}
}
},
{
"apiVersion": "2017-05-10",
"name": "updateVnetIntegrationSubnet",
"type": "Microsoft.Resources/deployments",
"resourceGroup": "[parameters('vnetRG')]",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"name": "[concat(parameters('vnetName'), '/', parameters('vnetIntegrationSubnet'))]",
"id": "[resourceId(parameters('vnetRG'), 'Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('vnetIntegrationSubnet'))]",
"properties": {
"addressPrefix": "[parameters('vnetIntegrationSubnetAddressPrefix')]",
"serviceEndpoints": [
{
"service": "Microsoft.Storage"

}
],
"delegations": [
{
"name": "0",
"properties": {
"serviceName": "Microsoft.Web/serverfarms"
}
}
],
"privateEndpointNetworkPolicies": "Enabled",
"privateLinkServiceNetworkPolicies": "Enabled"
},
"type": "Microsoft.Network/virtualNetworks/subnets",
"apiVersion": "2019-09-01"
}
]
}
}
},

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the nested Microsoft.Resources/deployments snippets and the Microsoft.Network/virtualNetworks/subnets resources shown in the issue. Reproduce the incremental deployment behavior and compare the resulting subnet settings with the declared properties; done when the requested subnet changes no longer remove or reset unspecified NSG, UDR, or other settings.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, json
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.