I have a list of IP addresses and a specific subnet which are to be allowed access to webapp. I'm able to loop through the IP restrictions using copy
function in ARM templates but I'm unable to add the subnet restriction in the same template. Is there a way I can get through this?
After going through a lot of docs and blogs, I found no way to achieve it using the same ARM template. In my case, I want to add both IP addresses and a subnet while using a copy
function(rather call it an ARM foreach loop). So, for adding multiple IP addresses(which are dynamically fetched within the ARM template from an other resource) and a subnet, I've got it resolved by executing the ARM first(this iterates and adds dynamically fetched IPs) and then a simple Az cmd as below which would add a security restriction to the same web app.
Add-AzWebAppAccessRestrictionRule -ResourceGroupName $ResourceGroupName -WebAppName $WebAppName -Name "subnet rule" -Priority 301 -Action Allow -SubnetName $subnetName -VirtualNetworkName $VnetName
That way both are in place :D