We have an Azure app service (website) which has an additional deployment slot called offline that we want to use when we have taken the main website offline for maintenance.
I am trying to write a PowerShell script that will switch between this offline slot and the production slot, or vice versa, depending on parameters passed to the script. However, the script must also perform additional actions when the switchover happens, hence it is important to know which slot is currently "active".
The problem is that I can't find a way of determining this. I'm using the Resource Manager cmdlets (*-AzureRm*
), and although I can call:
Get-AzureRmWebAppSlot -ResourceGroupName xxx -Name websitename -Slot offline
the object that this returns has nothing in it that can help me, as far as I can tell. It's the same story for the object returned by Get-AzureRmWebApp
.
As there doesn't seem to be a Resource Manager cmdlet for this, are there any other techniques I can use? All I can think of at the moment is to have a particular web page that only exists on the offline site, and check for the existence of that page by querying the live website: this should tell me which slot is currently live. This seems kind of hacky though.