Wednesday, February 26, 2014
Troubleshooting Windows Azure authentication in PowerShell.
Tuesday, February 25, 2014
Part-2: Azure and PowerShell: Connect to Windows Azure using PowerShell
Part-1 : Getting Started With Windows Azure And PowerShell
In my previous post, I have posted about getting started with Windows Azure and PowerShell.
We have already downloaded and installed the Window Azure PowerShell module.
Today we will connect to our Windows Azure subscription with PowerShell, so that we can run Windows Azure PowerShell cmdlets and start automating stuff.
Connect with Windows Azure
There are two ways to connect to the Windows Azure subscription,
1. Windows Azure AD method.
a. We can connect to window Azure using Ad method by providing our Azure subscriptions username and password but the main issue with Windows Azure AD authentication method is, that saved credentials are expired after 12 hours and after expiration we need to login in again. This is not a good choice when we want to automate tasks using PowerShell.
2. Using Certificates
a. When we use certificated method to login, they are valid until the subscription in available and certificates are valid. This is recommended option for automation of the task and for long running scripts.
Connect using Azure AD Method
To connect to Windows Azure using AD method, do the following.
Open Windows Azure PowerShell {or Import-Module Azure in your current PowerShell console.}
Run the Add-AzureAccount cmdlet
This will open a “Sign in to Windows Azure” window.
Provide your windows Azure’s subscription email address and click on continue.
Or might be you will see the below asking for your username and password, provide your details {which you use to login to https://manage.windowsazure.com and click on Sign in.
Once is account is verified, you will be return back to the PowerShell console.
For testing let’s run the Get-AzureAccount cmdlet and see if it return anything.
Get-AzureAccount
Seeming working J and you are successfully connected to the cloud.
Connect using Certificate Method.
To connect to Windows Azure using PowerShell, we need to get our certificate first. To get the certificate please do the following.
1. Open Windows Azure PowerShell console, or import the Windows Azure PowerShell module to your current PowerShell profile.
2. Run the Get-AzurePublishSettingsFile cmdlet
3.
5.
6. This cmdlet redirect to the Windows Azure login page and please provide your Windows Azure login credential to login to the portal.
7. Once you successfully login, you will see the below page and your certificated will download automatically.
9. Now we have to import the publish setting file.
10. Now run Import-AzurePublishSettingsFile cmdlet and provide the path to the certificate which we have just downloaded.
12. Once you run the above cmdlet. Delete your certificate file which we have just downloaded.
For testing let’s run Get-AzureSubscription cmdlet. And everything is working perfectly.
That’s all for now. See you in my next blog post.
Regards
Aman Dhally
Part-1: Azure and PowerShell: Getting Started with Windows Azure and PowerShell
After publishing PowerShell tutorial series on “PowerShell and Event Viewer,” “PowerShell and DHCP Server”, I am going to start a new series on “PowerShell and Windows Azure”.
What is windows Azure?
Windows Azure is an open and flexible cloud platform that enables you to quickly build, deploy and manage applications across a global network of Microsoft-managed datacentres. You can build applications using any language, tool or framework. And you can integrate your public cloud applications with your existing IT environment. {Source}.
In windows Azure, you can create a virtual machines, mobile apps, online Active Directory, websites, SQL databases and lots of other things on cloud.
Windows Azure is awesome! You can create website, mobile app backend, SQL database, in just few clicks, Imagine creating a fully functional virtual machine in a few clicks of mouse buttons.
It’s amazingly fast and very easy to do.
Windows Azure is a revolutionary product and in coming time Windows Azure will change a whole IT eco system. Imagine all of your Servers in cloud and all best engineers from Microsoft are taking care of it and you don’t have to worry to patch them, keep them updated and worried about their backups.
You can also signup for windows Azure one month free trial from this link: http://www.windowsazure.com/en-us/pricing/free-trial/
Windows Azure supports PowerShell and that’s open a wide range of possibilities of automation, reporting. We can use PowerShell to automate the Azure supported tasks.
Download and Install Windows Azure PowerShell Module
To connect PowerShell and Window Azure, We have to install Microsoft Windows Azure PowerShell module first, you can download the module from this link.
This will download a file with a name something like “WindowsAzurePowerShell.3f.3f.3fnew.exe”
Double click on the file and click on Install.
For now, keep the all setting as it as and click on “I accept”
It will start installing the Windows Azure PowerShell module and supported applications.
Once all application are installed click on “Finish”
Testing Windows Azure PowerShell Module
On your Windows 8 , you can search for windows Azure Powershell and you will find a PowerShell console dedicated for Windows Azure only.
And if you want to import a Windows Azure module in to your PowerShell console or IDE, you can use Import-module cmdlet for it.
Import-Module Azure
That’s all for today and in our next blog post we will discuss how to connect with PowerShell and Windows Azure.
Thanks
Regards