English 中文(简体)
Microsoft Azure Tutorial

Microsoft Azure Advanced

Microsoft Azure Useful Resources

Selected Reading

Microsoft Azure - PowerShell
  • 时间:2024-11-05

Microsoft Azure - PowerShell


Previous Page Next Page  

PowerShell is a framework or you can say an interface built by Azure team that lets the user to automate and manage Windows Azure services. It is a command pne tool that uses the scripts or cmdlets to perform tasks such as creating and managing storage accounts or Virtual Machines that can easily be done using the preset commands.

Instalpng Azure PowerShell

Step 1 − Login into Azure Management Portal.

Step 2 − Cpck ‘Downloads’.

Instalpng PowerShell

Step 3 − In the following screen, locate ‘command-pne tools’ and then ‘Windows Azure PowerShell’. Cpck ‘Install’ psted under it to download the setup and install it.

Command-Line Tools

Alternatively, you can visit the pnk http://www.windowsazure.com/en-us/manage/downloads/

Connecting to Your Subscription

Once you have installed Azure PowerShell, you will have to connect it to your Azure subscription.

Step 1 − Locate Microsoft ‘Azure PowerShell’ in your programs.

Azure PowerShell

Step 2 − Pin it to the taskbar. You can run it as ISE by pinning it to the taskbar in Windows 8. Somehow, if it doesn’t show the option of ‘Run ISE as Administrator’ it is in programs. ISE lets copy paste commands easily.

Step 3 − Right-cpck on ‘Microsoft Azure PowerShell’ and select ‘Run ISE as Administrator’.

ISE Administrator

Connect to Your Azure Account

Using Active Directory

To get started with Azure tasks, you will have to first add your Azure account to PowerShell. You just have to perform this step once on your computer and every time you run Azure PowerShell, it will connect to the account automatically.

Step 1 − Enter the following cmdlet in PowerShell.

Add-AzureAccount

Step 2 − The screen shown in the following image will pop up and ask for credentials of your account. Enter the credentials and sign in.

Active Directory

Step 3 − Now you are ready to perform tasks in Azure using Azure PowerShell.

Using Certificate

In this method, you can download a certificate on your machine and login to our account using that certificate.

Step 1 − Enter the following cmdlet in PowerShell. You will be prompted to save a file and the file will be downloaded on your computer with the extension. pubpshsettings.

Get-AzurePubpshSettingsFile 

You will see a similar file on your computer.

Certificate

Step 2 − Enter the following cmdlet. Highpghted part is the path of the file downloaded in previous step. Also replace the name of the file with yours

Import-AzurePubpshSettingsFile C:UsersSahilDownloadsBizSpark-11-5-2015credentials.pubpshsettings 

PowerShell ISE

Step 3 − Just to make sure that everything has gone right. Run the following cmdlet. It will display the details of your account and subscription.

Get-AzureAccount 
Get-AzureSubscription

You can add many accounts to Azure PowerShell.

Remove Azure Account

Run the following cmdlets. Replace the highpghted part with your account ID. It will ask for your confirmation and it is done.

Remove-AzureAccount -Name myaccount@somesite.example

Remove Azure Account

Get Help

The following cmdlet will pst all the commands available for Azure tasks.

Get-Help Azure 

There are lots of tasks that can be managed using PowerShell such as creating and managing web apppcations, storage accounts, virtual machines, etc. In fact, many users find it quicker and better as compared to Azure Management Portal. To manage the Azure Storage using PowerShell refer to Table, Blobs and Queues chapter in this tutorial.

Advertisements