Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
README.md

Windows Azure PowerShell

This repository contains a set of PowerShell cmdlets for developers and administrators to develop, deploy and manage Windows Azure applications.

Features

  • Account
    • Get and import Azure publish settings
    • Login with Microsoft account or Organizational account through Windows Azure Active Directory
  • Environment
    • Get the different out-of-box Windows Azure environments
    • Add/Set/Remove customized environments (like your Windows Azure Pack environments)
    • Get Azure publish settings for a particular environment
  • Subscription
    • Manage Azure subscription
    • Manage AffinityGroup
  • Website
    • Manage website, such as CRUD, start and stop.
    • Manage slot
    • Manage WebJob
    • Deploy project via WebDeploy
    • Diagnostics
      • Configure site and application diagnostics
      • Log streaming
      • Save log
  • Cloud Services
    • Create scaffolding for cloud service and role. Role support includes Node.js, PHP, Django and Cache.
    • Manage cloud service and role, such as CRUD, start and stop.
    • Manage extension
    • Start/Stop Azure emulator.
    • Manage certificate.
    • Manage cloud service extensions
      • Remote desktop
      • Diagnostics
  • Storage
    • Manage storage account and access key.
    • Manage storage container and blob, with paging.
    • Copy storage blob.
    • Manage storage table.
    • Manage storage queue.
    • Create SAS token.
    • Manage metrics and logging.
    • Configure timeout
  • SQL Azure
    • CRUD support for database server, database and firewall rule.
    • Get database server quota.
    • Get/Set database server service objective.
    • Manage database copies and active geo-replication.
    • Get dropped databases that can be restored.
    • Issue requests to restore a live or dropped database to a point in time.
    • Issue requests to recover a database from an unavailable database server.
  • Service Bus
    • Manage service bus namespaces.
  • VM
    • Manage VM, such as CRUD, import/export and start/stop/restart.
    • Manage VM image, such as CRUD.
    • Manage disk, such as CRUD.
    • Manage VM endpoint, such as CRUD and ACL.
    • Get/Set VM sub net.
    • Manage certificate and SSH key.
    • PowerShell remoting
    • Manage extension
  • Deployment
    • Manage deployment, such as CRUD, move, upgrade and restore.
    • Get/Create DNS settings of a deployment.
  • VNet
    • Manage virtual network config, connection and gateway.
    • Manage static IP
  • HDInsight
    • Manage clusters, such as CRUD, add/set storage
    • Manage jobs, such as CRUD, start/stop/wait/invoke
    • Manage HTTP service access. such as grant/revoke
  • Store
    • View available Windows Azure Store Add-On plans.
    • Purchase, view, upgrade and remove Windows Azure Store Add-On instances.
  • Utility
    • Test whether a name is available. Currently support cloud service name, storage account name and service bus namespace name.
    • Get the list of geo locations supported by Azure.
    • Get the list of OS supported by Azure.
    • Direct you to Azure portal.
  • Windows Azure Pack
    • Web Site: CRUD web site, deployment, configure and get log, start/stop/restart/show web site
    • Service Bus: CRD namespace
    • VM: CRUD VM, get OS disk, size profile and VM template, start/stop/restart/suspend/resume VM
  • ExpressRoute
    • Manage dedicated circuit
    • Manage BGP peering
  • Scheduler
    • Manage job collections
    • Manage HTTP and storage queue jobs
  • Resource Manager
    • Manage resource groups and deployments
    • Query and download gallery templates
    • Manage individual resources

For detail descriptions and examples of the cmdlets, type

  • help azure to get all the cmdlets.
  • help node-dev to get all Node.js development related cmdlets.
  • help php-dev to get all PHP development related cmdlets.
  • help python-dev to get all Python development related cmdlets.
  • help <cmdlet name> to get the details of a specific cmdlet.

Supported Environments

Installation

Microsoft Web Platform Installer

  1. Install Microsoft Web Platform Installer.
  2. Open Microsoft Web Platform Installer and search for Windows Azure PowerShell.
  3. Install.

You can also find the standalone installers for all the versions at Downloads

Source Code

  1. Download the source code from GitHub repo
  2. Follow the Windows Azure PowerShell Developer Guide

Supported PowerShell Versions

Get Started

In general, following are the steps to start using Windows Azure PowerShell

  • Get yourself authenticated with Windows Azure. For details, please check out this article.
    • Option 1: Login with your Microsoft account or Organizational account directly from PowerShell. Windows Azure Active Directory authentication is used in this case. No management certificate is needed.
    • Option 2: Download and import a publish settings file which contains a management certificate.
  • Use the cmdlets

The first step can be different for different environment you are targeting. Following are detail instructions for each supported environment.

Windows Azure

If you use both mechanisms on the same subscription, Windows Azure Active Directory authentication always wins. If you want to go back to management certificate authentication, please use Remove-AzureAccount, which will remove the Windows Azure Active Directory information and bring management certificate authentication back in.

Login directly from PowerShell (Windows Azure Active Directory authentication)

# Pop up an embedded browser control for you to login
Add-AzureAccount

# use the cmdlets to manage your services/applications
New-AzureWebsite -Name mywebsite -Location "West US"

Use publish settings file (Management certificate authentication)

# Download a file which contains the publish settings information of your subscription.
# This will open a browser window and ask you to log in to get the file.
Get-AzurePublishSettingsFile

# Import the file you just downloaded.
# Notice that the file contains credential of your subscription so you don't want to make it public
# (like check in to source control, etc.).
Import-AzurePublishSettingsFile "<file location>"

# Use the cmdlets to manage your services/applications
New-AzureWebsite -Name mywebsite -Location "West US"

Windows Azure China

# Check the environment supported by your Windows Azure PowerShell installation.
Get-AzureEnvironment

# Download a file which contains the publish settings information of your subscription.
# Use the -Environment parameter to target Windows Azure China.
# This will open a browser window and ask you to log in to get the file.
Get-AzurePublishSettingsFile -Environment "AzureChinaCloud"

# Import the file you just downloaded.
# Notice that the file contains credential of your subscription so you don't want to make it public
# (like check in to source control, etc.).
Import-AzurePublishSettingsFile "<file location>"

# Use the cmdlets to manage your services/applications
New-AzureWebsite -Name mywebsite -Location "China East"

Windows Azure Pack

# Add your Windows Azure Pack environment to your Windows Azure PowerShell installation.
# You will need to know the following information of your Windows Azure Pack environment.
# 1. URL to download the publish settings file    Mandatory
# 2. Management service endpoint                  Optional
# 3. Management Portal URL                        Optional
# 4. Storage service endpoint                     Optional
Add-WAPackEnvironment -Name "MyWAPackEnv" `
    -PublishSettingsFileUrl "URL to download the publish settings file>" `
    -ServiceEndpoint "<Management service endpoint>" `
    -ManagementPortalUrl "<Storage service endpoint>" `
    -StorageEndpoint "<Management Portal URL>"

# Download a file which contains the publish settings information of your subscription.
# Use the -Environment parameter to target your Windows Azure Pack environment.
# This will open a browser window and ask you to log in to get the file.
Get-WAPackPublishSettingsFile -Environment "MyWAPackEnv"

# Import the file you just downloaded.
# Notice that the file contains credential of your subscription so you don't want to make it public
# (like check in to source control, etc.).
Import-WAPackPublishSettingsFile "<file location>"

# Use the cmdlets to manage your services/applications
New-WAPackWebsite -Name mywebsite

2 Modes

Starting from 0.8.0, we are adding a separate mode for Resource Manager. You can use the following cmdlet to switch between the

  • Service management: cmdlets using the Azure service management API
  • Resource manager: cmdlets using the Azure Resource Manager API

They are not designed to work together.

Switch-AzureMode AzureServiceManagement
Switch-AzureMode AzureResourceManager

Find Your Way

All the cmdlets can be put into 3 categories:

  1. Cmdlets support both Windows Azure and Windows Azure Pack
  2. Cmdlets only support both Windows Azure
  3. Cmdlets only support Windows Azure Pack

  • For category 1, we are using an "Azure" prefix in the cmdlet name and adding an alias with "WAPack" prefix.
  • For category 2, we are using an "Azure" prefix in the cmdlet name.
  • For category 2, we are using an "WAPack" prefix in the cmdlet name.

So you can use the following cmdlet to find out all the cmdlets for your environment

# Return all the cmdlets for Windows Azure
Get-Command *Azure*

# Return all the cmdlets for Windows Azure Pack
Get-Command *WAPack*

If you want to migrate some scripts from Windows Azure to Windows Azure Pack or vice versa, as long as the cmdlets you are using are in category 1, you should be able to migrate smoothly.

Need Help?

Be sure to check out the Windows Azure Developer Forums on Stack Overflow if you have trouble with the provided code.

Contribute Code or Provide Feedback

If you would like to become an active contributor to this project please follow the instructions provided in Windows Azure Projects Contribution Guidelines.

If you encounter any bugs with the library please file an issue in the Issues section of the project.

Learn More

Something went wrong with that request. Please try again.