After uptdating apim from stv1 to stv2 i’m not able remove region via powershell with this command:
Get-AzApiManagement -ResourceGroupName $APIMresourceGroupName -Name $APIMaccountName | Remove-AzApiManagementRegion -Location "North Europe" | Set-AzApiManagement
it worked until there was v1. Now I got following error:
Set-AzApiManagement: ‘SubnetResourceId’ does not match expected pattern ‘^/subscriptions/[^/]/resourceGroups/[^/]/providers/Microsoft.(ClassicNetwork|Network)/virtualNetworks/[^/]/subnets/[^/]$’.
If i just run
Get-AzApiManagement -ResourceGroupName $APIMresourceGroupName -Name $APIMaccountName | Remove-AzApiManagementRegion -Location "North Europe"
the region is removed from the object, but if i se the modify with set-azapimanagent i got error written before.
I’m using latest cmdlet api.management. There is someone that have same problem?
Thanks
2
Answers
I found the resolution here https://github.com/Azure/azure-powershell/issues/22565 :
above a small example. Basically with migration to v2 the $apimSKU.VirtualNetwork.SubnetResourceId is in lowercase and Set-AzApiManagement does not manage it.
Regards
If you are trying to remove the secondary location from APIM resource stv2.1 platform version then below command should work for you as it worked for me.
Post executing this command, my apim instance got updated as shown below.
Please review your command as the error you are getting is related to subnet.
For Premium tier–
I have enabled internal vnet in APIM instance and executed same command successfully which removed the secondary location.
I had these two locations-
Once the APIM instance gets updated successfully you won’t be able to see Service is being updated message and then secondary location will get removed.
Please make sure to execute the command when the service is not in update state.