I have been using the New-AzureReservedIP
cmdlet to create a new reserved IP address in Azure and associate it with an Azure cloud service staging slot. Basically what is described in this question. This cmdlet was part of the Azure module. However, as we know the Azure and AzureRM modules are not available in PS7 anymore. And this workstep is not even available in the Azure GUI.
As Microsoft recommends switching to PS7 and the Az module I assume that there is another way there to achieve the same thing. However, so far I was unable to find a solution.
The problem is that the staging slot requires a reserved IP if the production slot has one. To limit expenses we delete our staging slots after deployment. If we'd just keep and update it, that would not be a problem. Also, I was unable to find a way to re-use an existing reserved IP (that was created with New-AzureReservedIP
previously) for the next staging deployment, so far I always needed to create a new one using New-AzureReservedIP
. I ended up having quite a few reserved IP addresses which I don't use anymore so I wonder if they can be recycled somehow?
What would be best practice to solve this in PS7?
Reserved IP belongs to ASM API (Classic) and will be deprecated by 2023. Hence it doesn't exist in ARM. The new ARM API doesn't support this functionality. In ARM you have the option to use static Public IP (IP owned by Microsoft) or Public IP Prefix which is when you buy the IP address/IP range.
New-AzPublicIpAddress https://learn.microsoft.com/en-us/powershell/module/az.network/new-azpublicipprefix?view=azps-4.5.0
New-AzPublicIpPrefix https://learn.microsoft.com/en-us/powershell/module/az.network/new-azpublicipaddress?view=azps-4.5.0
But one thing to note is that if you are using App Service you actually get a Static Public IP for your App Service but that one is shared with many other customers hence you need to use your App Service URL eg. https://[AppServiceName].azurewebsites.net or add a Custom Domain to your App Service.
So if you really need a Public IP that is not shared you have to move over to IaaS eg. Virtual Machines