Skip to content

Instantly share code, notes, and snippets.

@pratapprashant
Created June 19, 2016 22:14
Show Gist options
  • Save pratapprashant/e1ed68ad4c8c625704fda604c694db20 to your computer and use it in GitHub Desktop.
Save pratapprashant/e1ed68ad4c8c625704fda604c694db20 to your computer and use it in GitHub Desktop.
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