By now you might have in your mind -- Why should one even care about a Console when we already have an Interactive Portal? Here we will see why exactly we need it.
Deploying an Application in a Traditional Data Center
- Order server and networking hardware.
- Wait for hardware to ship.
- Install and configure networking hardware.
- Install and configure server hardware (apply firmware updates as needed).
- Install a base operating system on the server hardware.
- Patch the base operating system.
- Install software applications and roles.
- Deploy applications.
- Repeat steps 3 through 8 (and likely steps 1 and 2, depending on how accurate the initial planning was) for staging, development, and testing environments.
Deploying an Application in the Cloud (Without Automation)
- Launch the management portal.
- Create and configure each virtual machine.
- Patch the base operating system.
- Install software applications and roles.
- Deploy applications.
- Repeat steps 2 through 5 for staging, development, and testing environments.
Deploying an Application in the Cloud (with Automation)
- Identify repeatable processes.
- Create automation configuration and scripts for step 1.
- Deploy scripts for application.
- Repeat step 3 for staging, development, and testing environments.
You can see that Deployment on Cloud with Automation tops the flexibility and time consumption.
How to Start with Windows Azure Automation using Cmdlets
The Microsoft Azure PowerShell cmdlets are officially supported on Windows 2008 R2, Windows 7, Windows 8/8.1, and Server 2012/2012 R2. Microsoft PowerShell comes with all these Operating Systems by default but for all the Cmdlets, they come in separate. So, there are specific Cmdlets for different purposes, for example, for Microsoft Azure, SQL Server, Web Automation and like that. For Microsoft Azure automation we need to have Azure Powershell
- Go to Microsoft Azure home page.
- Click the Downloads link on the page (See at the very bottom of the page)
- Click the link for Command Line Tools
- The installation can take several minutes because there is a dependency on the Microsoft Azure SDK, which has its own set of dependencies.
Setting Up Your Environment
When the installation for the cmdlets is complete, you can choose your method of running them. You can launch PowerShell either by clicking the PowerShell icon on your computer or by running powershell.exe.
There is another tool for Powershell called Powershell ISE (Integrated Scripting Environment). I prefer to use this one. Being a Visual Studio user I always like IntelliSense and Code-Completion! I think you'll like it too.
You can start it by running "powershell_ise.exe" .
Powershell ISE really looks more powerful and has many more commands to perform many more operations.
To do anything with your Azure subscription using Azure Powershell you need to Authenticate first. This can be done in two ways:
- Authenticating with a Certificate
- Using Microsoft Azure AD to Authenticate with Powershell
Step 2: Authenticating with a Certificate,
The easiest way of doing Authentication with a certificate is to download ".publishsettings" file from Microsoft Azure using the "Get-AzurePublishSettingsFile" Cmdlet.
You will be prompted to download a .publishsettings file after successful login. Be careful with the file as it contains your subscription information along with a newly generated Management Certificate. Whoever has access to this file has access to your subscription.
Next step is to import the .publishsettings file into Azure Powershell using "Import-AzurePublishSettings" Cmdlet.
On successful import it will show you the account details and now the console is ready to talk to your Microsoft Azure subscription.
Step 2: Using Microsoft Azure AD to Authenticate with Powershell,
Use "Add-AzureAccount" Cmdlet to Authenticate using Microsoft Azure Active Directory.
It will prompt you for your Microsoft Azure subscription login credentials and return a Token to Azure Powershell for making authenticated requests. The returned token remains valid for 12 hours. After 12 hours you need to authenticate again using the same Cmdlet.
And that's it, your Powershell console is configured.
You can manage your subscription with these following Cmdlets:
- Get-AzureSubscription: returns and enumerates subscriptions that have been imported or manually configured with the Set-AzureSubscription cmdlet.
- Select-AzureSubscription: helps switching between different subscriptions in your account.
- Set-AzureSubscription: allows you to add a subscription to the stored settings or change properties on an existing subscription.
- Remove-AzureSubscription: helps removing the subscription from local PowerShell configuration.
We will see more on these Cmdlets in further discussions.
Summary
In this article we learned that we can use Microsoft Azure Powershell, an advanced console application, for easier manipulation of Microsoft Azure resources using few simple commands. We have learned how to get started with it. In the next article we will learn how to setup and configure a Web site just by using Microsoft Azure Powershell and Cmdlets.
Thanks for reading!