Note: This article was originally published in 2014. Some steps, commands, or software versions may have changed. Check the current Windows Azure Cloud documentation for the latest information.

In this step-by-step guide, you’ll learn manage windows azure with powershell. Microsoft Azure is a cloud computing platform offering IaaS, PaaS, and SaaS services including compute, analytics, storage, and networking.

How to: Manage Windows Azure with PowerShell

You can manage your Windows Azure account via PowerShell with an array of commands at your disposal. Below is a quick reference guide of the commands available. You can connect to Microsoft’s Azure Cloud using the (http://www.windowsazure.com/en-us/downloads/). After you have installed the SDK you should be able to execute the commands in the reference guide to manage your subscription/services/etc. First you will need to connect to your account via the following instructions:

import-module Azure

# download publish settings file
Get-AzurePublishSettingsFile

# import the settings you just downloaded
Import-AzurePublishSettingsFile "C:\Users\<user>\Downloads\MySub-DATE-credentials.publishsettings"

# view subscription details
Get-AzureSubscription

# select an active subscription
Select-AzureSubscription 'MySub'

Managing Subscriptions

NameDescription
Get-AzurePublishSettingsFileDownloads the publish-settings file for a Windows Azure subscription.
Get-AzureSubscriptionGets information about a Windows Azure subscription from a subscription data file saved in the user’s profile.
Import-AzurePublishSettingsFileImports Windows Azure subscription data from a .publishsettings file downloaded from the management portal.
Remove-AzureSubscriptionRemoves the settings for a Windows Azure subscription from the subscription data file.
Select-AzureSubscriptionSelects the current Windows Azure subscription.
Set-AzureSubscriptionConfigures and stores common Windows Azure subscription settings.

Managing Storage Accounts

NameDescription
Add-AzureVhdUploads a virtual hard disk (in .vhd file format) from an on-premises virtual machine to a blob in a cloud storage account in Windows Azure.
Get-AzureStorageAccountGets the storage account objects for the current subscription.
Get-AzureStorageKeyReturns the primary and secondary storage account keys for a Windows Azure storage account.
New-AzureStorageAccountCreates a new storage account in a subscription.
New-AzureStorageKeyRegenerates storage keys for a Windows Azure storage account.
Remove-AzureStorageAccountDeletes the specified storage account from a subscription.
Set-AzureStorageAccountUpdates the label and the description for a storage account in a subscription.

Managing Storage Blobs, Tables, and Queues

NameDescription
Get-AzureStorageBlobLists the blobs in a container.
Get-AzureStorageBlobContentDownloads a storage blob.
Get-AzureStorageBlobCopyStateGets the copy state of a specified storage blob.
Get-AzureStorageContainerLists the storage containers.
Get-AzureStorageQueueLists the storage queues.
Get-AzureStorageTableLists the storage tables.
New-AzureStorageContainerCreates a storage container.
New-AzureStorageContextCreates a storage context using storage credentials.
New-AzureStorageQueueCreate a storage queue.
New-AzureStorageTableCreates storage tables.
Remove-AzureStorageBlobRemoves the specified storage blob.
Remove-AzureStorageContainerRemoves the specified storage container.
Remove-AzureStorageQueueRemove the specified storage queues.
Remove-AzureStorageTableRemoves storage tables.
Set-AzureStorageBlobContentUploads a local file.
Set-AzureStorageContainerAclSets the public access permission to a storage container.
Start-AzureStorageBlobCopyStarts a copy operation to a blob.
Stop-AzureStorageBlobCopyStops a copy operation.

Deploying and Managing Virtual Machines

NameDescription
Add-AzureDataDiskAdds a new data disk to a Windows Azure virtual machine object.
Add-AzureDiskAdds a new disk to the Windows Azure disk repository.
Add-AzureEndpointAdds a new endpoint to a Windows Azure virtual machine.
Add-AzureProvisioningConfigAdds the provisioning configuration to a Windows Azure virtual machine.
Add-AzureVMImageAdds a new operating system image to the image repository.
Export-AzureVMExports a Windows Azure virtual machine state to a file.
Get-AzureDataDiskGets the data disk object at the specified LUN on the specified Windows Azure virtual machine.
Get-AzureDiskGets an object with information on disks in the Windows Azure disk repository.
Get-AzureEndpointGets an object with information about the endpoints assigned to a Windows Azure virtual machine.
Get-AzureOSDiskGets the operating system disk object for the specified virtual machine object.
Get-AzureVMRetrieves information from one or more Windows Azure virtual machines.
Get-AzureVMImageReturns an operating system image object.
Import-AzureVMImports a Windows Azure virtual machine state from a file.
New-AzureCertificateSettingCreates a setting object to insert an existing certificate into new Windows Azure virtual machines.
New-AzureQuickVMCreates and provisions a new Windows Azure virtual machine.
New-AzureSSHKeyCreates a SSH Key object to insert an existing certificate into new Linux-based Windows Azure virtual machines.
New-AzureVMCreates a new Windows Azure virtual machine.
New-AzureVMConfigCreates a new Windows Azure virtual machine configuration object.
Remove-AzureDataDiskRemoves a data disk from a virtual machine object.
Remove-AzureDiskRemoves a disk from the Windows Azure disk repository.
Remove-AzureEndpointDeletes an endpoint from a Windows Azure virtual machine object.
Remove-AzureVMRemoves a virtual machine.
Remove-AzureVMImageRemoves an operating system image from the Image Repository.
Restart-AzureVMRestarts a Windows Azure virtual machine.
Set-AzureDataDiskSets the host-cache mode on an existing data disk object.
Set-AzureEndpointUpdates an existing endpoint assigned to a Windows Azure virtual machine.
Set-AzureOSDiskUpdates the host-cache mode of a Windows Azure virtual machine operating system disk.
Save-AzureVMImageCaptures and saves the image of a running Windows Azure virtual machine.
Set-AzureVMSizeUpdates the role size from a virtual machine object.
Start-AzureVMStarts a Windows Azure virtual machine.
Stop-AzureVMShuts down a Windows Azure virtual machine.
Update-AzureDiskUpdates the label of a disk in the Windows Azure disk repository.
Update-AzureVMUpdates a Windows Azure virtual machine with the modifications made to the virtual machine object.
Update-AzureVMImageUpdates the label of an operating system image in the image repository.

Managing Virtual Networks

NameDescription
Get-AzureDnsGets an object with the DNS settings for the Windows Azure deployment.
Get-AzureSubnetGets a list of subnets associated with the specified Windows Azure virtual machine.
Get-AzureVNetConfigGets the Windows Azure virtual network configuration from the current subscription.
Get-AzureVNetConnectionReturns an object with all of the virtual network connections to the specified Windows Azure virtual network.
Get-AzureVNetGatewayRetrieves an object with information about a Windows Azure virtual network gateway.
Get-AzureVNetGatewayKeyReturns a shared key that can be used to configure a VPN device.
Get-AzureVNetSiteReturns an object describing Windows Azure virtual networks.
New-AzureDnsCreates a DNS settings object to be used when creating a Windows Azure virtual machine.
New-AzureVNetGatewayCreates a new Windows Azure Virtual Network Gateway to the specified Windows Azure virtual network.
Remove-AzureVNetConfigDeletes the network configuration from the current Windows Azure subscription.
Remove-AzureVNetGatewayRemoves the Windows Azure virtual network gateway to the specified virtual network.
Set-AzureSubnetDefines the subnet list for a Windows Azure virtual machine.
Set-AzureVNetConfigUpdates the virtual network settings for a Windows Azure cloud service.
Set-AzureVNetGatewayEnables or disables a Windows Azure Virtual Network Gateway.

Managing Network ACLs to Endpoints

NameDescription
Get-AzureAclConfigGets a configuration object for an access control list (ACL).
New-AzureAclConfigCreates a new, empty configuration object for an access control list (ACL).
Remove-AzureAclConfigCreates a configuration object for an access control list (ACL).
Set-AzureAclConfigSets the configuration object for an access control list (ACL).

Deploying and Managing Cloud Services

NameDescription
Add-AzureCacheWorkerRoleAdds a dedicated cache worker role to the current service.
Add-AzureCertificateUploads a service certificate for the specified cloud service.
Add-AzureDjangoWebRoleCreates the required files and configuration (sometimes referred to as scaffolding) for a Python Django application.
Add-AzureNodeWebRoleCreates required files and folders for a Node.js application.
Add-AzurePHPWebRoleCreates the required files and configuration (sometimes referred to as scaffolding) for a PHP application.
Add-AzureWebRoleAdds a web role.
Add-AzureNodeWorkerRoleCreates the required files and folders for a Node.js application to be hosted in the cloud via node.exe
Add-AzurePHPWorkerRoleCreates the required files and configuration (sometimes referred to as scaffolding) for a PHP application that will be hosted in Windows Azure through php.exe.
Add-AzureWorkerRoleCreates required files and configuration (sometimes referred to as scaffolding) for a custom worker role.
Disable-AzureServiceProjectRemoteDesktopDisables remote desktop access to a cloud service.
Enable-AzureMemcacheRoleEnable memcached for the specified web role, configured to communicate with the specified dedicated cache role.
Enable-AzureServiceProjectRemoteDesktopEnables remote desktop access to a cloud service.
Get-AzureAffinityGroupReturns an object that represents a Windows Azure affinity group.
Get-AzureCertificateGets a certificate object from the specified Windows Azure service.
Get-AzureDeploymentGets details of a specified deployment.
Get-AzureOSVersionLists the versions of the guest operating system that are currently available in Windows Azure.
Get-AzureRemoteDesktopFileGets a remote desktop connection file (.RDP) for the specified Windows Azure virtual machine.
Get-AzureRoleReturns a list of roles in your Windows Azure service.
Get-AzureServiceReturns an object with information about the cloud services for the current subscription.
Get-AzureServiceProjectRoleRuntimeGet the runtimes available to install in a role.
Move-AzureDeploymentSwaps the deployments in production and staging.
New-AzureAffinityGroupCreates a new affinity group for the current Windows Azure subscription.
New-AzureDeploymentCreates a new deployment from a service comprising web roles and worker roles.
New-AzureRoleTemplateCreates web and worker role templates.
New-AzureServiceCreates a new Windows Azure service.
New-AzureServiceProjectCreates the required files and configuration (sometimes referred to as scaffolding) for a new service.
Publish-AzureServiceProjectPublish the current service to Windows Azure.
Remove-AzureAffinityGroupDeletes an affinity group in the specified subscription.
Remove-AzureCertificateDeletes the specified certificate from the Windows Azure service.
Remove-AzureDeploymentDeletes the specified deployment of a Windows Azure cloud service.
Remove-AzureServiceDeletes the specified service from Windows Azure.
Reset-AzureRoleInstanceRequests a reboot or reimage of a single role instance or all role instances of a specific role.
Save-AzureServiceProjectPackagePackages the service project into Windows Azure cloud package (*.cspkg).
Set-AzureAffinityGroupUpdates the properties of a Windows Azure affinity group.
Set-AzureDeploymentSets status, upgrade mode, and configuration settings of a Windows Azure deployment.
Set-AzureRoleSets the number of instances of a Windows Azure role to run.
Set-AzureServiceSets or updates the label and description of the specified Windows Azure service.
Set-AzureServiceProjectSets the default location, subscription, slot, and storage account for the current service.
Set-AzureServiceProjectRoleSets the number of instances or the runtime version of a role.
Set-AzureWalkUpgradeDomainWalks the specified upgrade domain.
Start-AzureEmulatorStarts the compute and storage emulators.
Start-AzureServiceStarts the specified hosted service in Windows Azure.
Stop-AzureEmulatorStops the compute emulator.
Stop-AzureServiceStops the current hosted service.
Test-AzureNameTests whether a Windows Azure service or storage name is already in use.

Deploying and Managing Websites

NameDescription
Get-AzureWebsiteGets information about websites in Windows Azure associated with the current subscription.
Get-AzureWebsiteDeploymentGets the deployments for a website in Windows Azure.
Get-AzureWebsiteLocationGets all available website locations.
New-AzureWebsiteCreate a new website to run in Windows Azure.
Remove-AzureWebsiteRemoves the specified website from Windows Azure.
Restart-AzureWebsiteStops and then restarts the specified website.
Restore-AzureWebsiteDeploymentRedeploys a previous deployment of a website in Windows Azure.
Save-AzureWebsiteLogDownloads and saves the logs for a specified website.
Set-AzureWebsiteConfigures a website running in Windows Azure.
Show-AzurePortalShow the Windows Azure Management Portal.
Show-AzureWebsiteOpens a browser on a specified website.
Start-AzureWebsiteStarts the specified website.
Stop-AzureWebsiteStops the specified website.

Managing Service Bus

NameDescription
Get-AzureSBLocationGets the location of the Service Bus.
Get-AzureSBNamespaceGets the namespace.
New-AzureSBNamespaceCreates a service namespace.
Remove-AzureSBNamespaceRemoves a service namespace

(http://img.zemanta.com/zemified_h.png?x-id=4c50300a-f124-41da-9737-d0c5f80c10c2)](http://www.zemanta.com/?px “Enhanced by Zemanta”)

Summary

You’ve successfully learned manage windows azure with powershell. If you run into any issues, double-check the prerequisites and ensure your Windows Azure Cloud environment is properly configured.