I'm currently trying to figure out if its possible to use an arm template to assign a NSG that's been created in a separate resource group to the subnet of a new resource group being spun up via an ARM template. I've come across multiple templates where the template creates and applies a NSG to an existing subnet(like the one below.) I'm trying to assign a NSG that already exists to an newly created subnet if possible.
Has anyone ever attempted this that might have some pointers, or are there any good resources out there I may have missed in my initial googling that I could leverage to complete this?
yeah, just do this:
"subnets": [
{
"name": "someName",
"properties": {
"addressPrefix": "somePrefix",
"networkSecurityGroup": {
"id": "[resourceId('rgName', 'Microsoft.Network/networkSecurityGroups', 'nsgName')]"
}
}
}