Click here to Skip to main content
15,885,216 members
Articles / Hosted Services / Azure

Set-AzureSubscription from a Publish File

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
31 Jan 2017Ms-PL 4.4K   1  
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:

This article was originally posted at http://blog-aois.azurewebsites.net?p=211

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


Written By
Software Developer Freelance
France France
I am currently the CTO of Metaco, we are leveraging the Bitcoin Blockchain for delivering financial services.

I also developed a tool to make IaaS on Azure more easy to use IaaS Management Studio.

If you want to contact me, go this way Smile | :)

Comments and Discussions

 
-- There are no messages in this forum --