Do you remenber Devops? I introduce some in previous article..
NICconf Opening and Keynote: Modernizing Windows Server/Modernizing Ourselves – by Jeffrey Snover
Now the Devops seems to be sat as goal for Cloud OS of Microsoft, it means not only Azure but also Windows Server 2012 and System Core SP1. Here's great ntroduction to "Getting Started Windows Azure with PowerShell".
Michael Washam - Introduction to Windows Azure PowerShell
Let have a look this session.
Beginning
The session was made by Michael Washam. Aim of this sessions is "Getting started Windows Azure with PowerShell", means "control Subscription with PowerShell". The key-word is Devops.
"Optimization = Pay as You Go = Automation = Coding"
Why with use PowerShell? Because it is the way to achieve Automation.
What can you do with PowerShell 1. Automation 2. Provision Fully Configured Virtual Machine 3. Virtual Networking
1. Get Azure PowerShell
You can get PowerShell Cmdlets for Windows Azure from below URI. Make sure your have an Subscription Account binding with Azure Subscription.... Me? no I wans't retrieve yet :(
Azure PowerShell Download. (Automatically configures Subscription ID, Certificate) http://windows.azure.com/download/publishprofile.aspx
Set your StorageSubscription
Let's begin switching subscription settings.
Switching Between Subscription Settings. (Multiple Subscription Support)
This is to retrieve multiple Subscriptions of your zure account
Get-AzureSubscription | %{ Select-AzureSubscription $_.SubscriptionName #Perform Management Operation Against Each Subscription }
Wow, let's try.
Available to setup the current storage account from PowerShell
1. Returns Storage Account
Get-AzureStorageAccount | Select StorageAccountName
2. Sets the Current Storage Account... hmmmmm... no result... you not obtain any AzureStorageAccount yet?
Set-AzureSubscription 'somesub1' -CurrentStorageAccount 'mystorage'
3. cmdlets like New-AzureQuickVM will use this Account (This time not work, because you need to get storage account info first.)
Retrieve your AzurePublishSettingsFile
1. Let's try this command set.
Import-Module Azure Get-AzureSubscription Get-AzurePublishSettingsFile
2. Now you will navagate into Azure Platform. Login to Subscription and download AzurePublishSettingsFile into your local.
Import your AzurePublishSettingsFile
1. Sample here
Import-AzurePuclishSettingsFile -PublishSettingsFie D:\hoge\TechEd-SP-mm-dd-yyyy-credential-publishsettings
2. Now your default and curret subscription is imported file "TechEd-SP-mm-dd-yyyy-credential-publishsettings" which has been downloaded by Get-AzurePublishSettingsFile. 3. You can see your StorageAccount by:
Get-AzureStorageAccount | select StorageAccountName
Also,
Get-AzureSubscription | select SubscriptionName
Set your AzureSubscription
1. Now you can do it.
Set-AzureSubscription -Subscriptionname "TechED-SP" -CurrentStorageAccount mydemoStoragea1
2. then retrieve change
Get-AzureVM
Restart your VM through PowerShell
1. Restart your VM, please specify which to restart. Your can check names by Get-AzureVM
.
Restart-AzureVM -ServiceName myvm1demosvc -name myvm1
2. You will be noticed status of restart progress by notification bar on PowerShell.exe sample like
Get Development "Operation Status : Succeed" Restart-AzureVM "Operation Status: Inprogress"
Conclution
Getting started is over. Let's have a fun with next session.