Set-AzureSubscription from a Publish File





0/5 (0 vote)
Set-AzureSubscription from a Publish File
IaaS Management Studio generates Powershell script for everything you do.
Most operations on VMs start like that:
$cert64 = [System.Convert]::FromBase64String("#Base64 of the certificate....") $cert = New-Object 'System.Security.Cryptography.X509Certificates.X509Certificate2' $cert64, "" Set-AzureSubscription -SubscriptionName "AO-IS Bizpark" -SubscriptionId "a26aaa6a-e02a-2746-9140-4bdca437f224" -Certificate $cert -ServiceEndpoint https://management.core.windows.net/
This allows to make the script runnable everywhere with simple copy/paste without any other deployment.
If you are using the free version, or if you are adjusting the code for your own scripts, then you will prefer to create a subscription from a publish setting file downloaded from Azure Portal, so here is an alternative version to do the exact same thing from a publish file.
Set-AzureSubscription –SubscriptionName “Subscription from publishsettings” –SubscriptionDataFile “account.publishsettings”
As a reminder, you can get your publish settings file by going to the following link: