Created
November 14, 2017 23:49
-
-
Save renzors/715ab2273260a9f3c1229a7607dc02d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Setting up variables of our WebApp | |
$AzureWebSite = "MySite" | |
$SourceSlot = "staging" | |
$DestinationSlot = "production" | |
$AzureResourceGroup = "MyResourceGroup" | |
#Swapping | |
Switch-AzureRmWebAppSlot -SourceSlotName $SourceSlot -DestinationSlotName $DestinationSlot -ResourceGroupName $AzureResourceGroup -Name $AzureWebSite | |
#Getting Hybrid Connections from staging slot | |
$HybridConnectionsStaging = Get-AzureRmResource -ResourceGroupName $AzureResourceGroup -ResourceType Microsoft.Web/sites/slots/hybridConnectionRelays -ResourceName "$AzureWebSite/$SourceSlot" -ApiVersion 2016-08-01 | |
#Updating namespace and type in order to set up to the main slot | |
$HybridConnectionsStaging.ResourceName = $HybridConnectionsStaging.ResourceName -replace "/$SourceSlot", "" | |
$HybridConnectionsStaging.ResourceType = $HybridConnectionsStaging.ResourceType -replace "/slots", "" | |
#Creating the Hybrid Connection into main slot | |
New-AzureRmResource -Location $HybridConnectionsStaging.Location -Properties $HybridConnectionsStaging.Properties -ResourceName $HybridConnectionsStaging.ResourceName -ResourceType $HybridConnectionsStaging.ResourceType -ResourceGroupName $AzureResourceGroup -Force -ApiVersion 2016-08-01 | |
#Removing the Hybrid Connection of staging slot | |
Remove-AzureRmResource -ResourceId $HybridConnectionsStaging.ResourceId -Force -ApiVersion 2016-08-01 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment