Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
write-host "trying to load azure dlls"
Import-module azure
write-host "trying to log into Azure"
#Select-AzureSubscription -Default "Microsoft Azure Internal Consumption"
#Add-AzureAccount
#Login-AzureRmAccount
write-host "trying to get website details"
# Get-AzureRMResource -ResourceType "microsoft.web/sites" -ResourceGroupName $ResourceGroupName -ResourceName $WebsiteName
$AzureSubscription = "25d360ff-1859-4a27-aada-a216484284b3"
$ResourceGroupName = "InternalConsumptionResourceGroup"
$WebsiteName = "nptesting"
$NewAppServicePlanName = "My2ndAppServucePlan"
# $NewAppServicePlanName = "InternalConsumptionAppServicePlan"
$NewServerFarmId = "/subscriptions/" + $AzureSubscription + "/resourceGroups/" + $ResourceGroupName + "/providers/Microsoft.Web/serverfarms/" + $NewAppServicePlanName
$websiteResource = Get-AzureRMResource -ResourceType "microsoft.web/sites" -ResourceGroupName $ResourceGroupName -ResourceName $WebsiteName
#$websiteResource.Properties.ServerFarmId = "/subscriptions/25d360ff-1859-4a27-aada-a216484284b3/resourceGroups/InternalConsumptionResourceGroup/providers/Microsoft.Web/serverfarms/My2ndAppServucePlan"
#$websiteResource.Properties.ServerFarmId = "/subscriptions/25d360ff-1859-4a27-aada-a216484284b3/resourceGroups/InternalConsumptionResourceGroup/providers/Microsoft.Web/serverfarms/InternalConsumptionAppServicePlan"
$websiteResource.Properties.ServerFarmId = $NewServerFarmId
$websiteResource | Set-AzureRmResource -Force
write-host "done changing ASP"
Exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment