How to: Manage Windows Azure with PowerShell

 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 Azure Powershell SDK. 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

Name Description
Get-AzurePublishSettingsFile Downloads the publish-settings file for a Windows Azure subscription.
Get-AzureSubscription Gets information about a Windows Azure subscription from a subscription data file saved in the user’s profile.
Import-AzurePublishSettingsFile Imports Windows Azure subscription data from a .publishsettings file downloaded from the management portal.
Remove-AzureSubscription Removes the settings for a Windows Azure subscription from the subscription data file.
Select-AzureSubscription Selects the current Windows Azure subscription.
Set-AzureSubscription Configures and stores common Windows Azure subscription settings.

Managing Storage Accounts

Name Description
Add-AzureVhd Uploads 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-AzureStorageAccount Gets the storage account objects for the current subscription.
Get-AzureStorageKey Returns the primary and secondary storage account keys for a Windows Azure storage account.
New-AzureStorageAccount Creates a new storage account in a subscription.
New-AzureStorageKey Regenerates storage keys for a Windows Azure storage account.
Remove-AzureStorageAccount Deletes the specified storage account from a subscription.
Set-AzureStorageAccount Updates the label and the description for a storage account in a subscription.

Managing Storage Blobs, Tables, and Queues

Name Description
Get-AzureStorageBlob Lists the blobs in a container.
Get-AzureStorageBlobContent Downloads a storage blob.
Get-AzureStorageBlobCopyState Gets the copy state of a specified storage blob.
Get-AzureStorageContainer Lists the storage containers.
Get-AzureStorageQueue Lists the storage queues.
Get-AzureStorageTable Lists the storage tables.
New-AzureStorageContainer Creates a storage container.
New-AzureStorageContext Creates a storage context using storage credentials.
New-AzureStorageQueue Create a storage queue.
New-AzureStorageTable Creates storage tables.
Remove-AzureStorageBlob Removes the specified storage blob.
Remove-AzureStorageContainer Removes the specified storage container.
Remove-AzureStorageQueue Remove the specified storage queues.
Remove-AzureStorageTable Removes storage tables.
Set-AzureStorageBlobContent Uploads a local file.
Set-AzureStorageContainerAcl Sets the public access permission to a storage container.
Start-AzureStorageBlobCopy Starts a copy operation to a blob.
Stop-AzureStorageBlobCopy Stops a copy operation.

Deploying and Managing Virtual Machines

Name Description
Add-AzureDataDisk Adds a new data disk to a Windows Azure virtual machine object.
Add-AzureDisk Adds a new disk to the Windows Azure disk repository.
Add-AzureEndpoint Adds a new endpoint to a Windows Azure virtual machine.
Add-AzureProvisioningConfig Adds the provisioning configuration to a Windows Azure virtual machine.
Add-AzureVMImage Adds a new operating system image to the image repository.
Export-AzureVM Exports a Windows Azure virtual machine state to a file.
Get-AzureDataDisk Gets the data disk object at the specified LUN on the specified Windows Azure virtual machine.
Get-AzureDisk Gets an object with information on disks in the Windows Azure disk repository.
Get-AzureEndpoint Gets an object with information about the endpoints assigned to a Windows Azure virtual machine.
Get-AzureOSDisk Gets the operating system disk object for the specified virtual machine object.
Get-AzureVM Retrieves information from one or more Windows Azure virtual machines.
Get-AzureVMImage Returns an operating system image object.
Import-AzureVM Imports a Windows Azure virtual machine state from a file.
New-AzureCertificateSetting Creates a setting object to insert an existing certificate into new Windows Azure virtual machines.
New-AzureQuickVM Creates and provisions a new Windows Azure virtual machine.
New-AzureSSHKey Creates a SSH Key object to insert an existing certificate into new Linux-based Windows Azure virtual machines.
New-AzureVM Creates a new Windows Azure virtual machine.
New-AzureVMConfig Creates a new Windows Azure virtual machine configuration object.
Remove-AzureDataDisk Removes a data disk from a virtual machine object.
Remove-AzureDisk Removes a disk from the Windows Azure disk repository.
Remove-AzureEndpoint Deletes an endpoint from a Windows Azure virtual machine object.
Remove-AzureVM Removes a virtual machine.
Remove-AzureVMImage Removes an operating system image from the Image Repository.
Restart-AzureVM Restarts a Windows Azure virtual machine.
Set-AzureDataDisk Sets the host-cache mode on an existing data disk object.
Set-AzureEndpoint Updates an existing endpoint assigned to a Windows Azure virtual machine.
Set-AzureOSDisk Updates the host-cache mode of a Windows Azure virtual machine operating system disk.
Save-AzureVMImage Captures and saves the image of a running Windows Azure virtual machine.
Set-AzureVMSize Updates the role size from a virtual machine object.
Start-AzureVM Starts a Windows Azure virtual machine.
Stop-AzureVM Shuts down a Windows Azure virtual machine.
Update-AzureDisk Updates the label of a disk in the Windows Azure disk repository.
Update-AzureVM Updates a Windows Azure virtual machine with the modifications made to the virtual machine object.
Update-AzureVMImage Updates the label of an operating system image in the image repository.

Managing Virtual Networks

Name Description
Get-AzureDns Gets an object with the DNS settings for the Windows Azure deployment.
Get-AzureSubnet Gets a list of subnets associated with the specified Windows Azure virtual machine.
Get-AzureVNetConfig Gets the Windows Azure virtual network configuration from the current subscription.
Get-AzureVNetConnection Returns an object with all of the virtual network connections to the specified Windows Azure virtual network.
Get-AzureVNetGateway Retrieves an object with information about a Windows Azure virtual network gateway.
Get-AzureVNetGatewayKey Returns a shared key that can be used to configure a VPN device.
Get-AzureVNetSite Returns an object describing Windows Azure virtual networks.
New-AzureDns Creates a DNS settings object to be used when creating a Windows Azure virtual machine.
New-AzureVNetGateway Creates a new Windows Azure Virtual Network Gateway to the specified Windows Azure virtual network.
Remove-AzureVNetConfig Deletes the network configuration from the current Windows Azure subscription.
Remove-AzureVNetGateway Removes the Windows Azure virtual network gateway to the specified virtual network.
Set-AzureSubnet Defines the subnet list for a Windows Azure virtual machine.
Set-AzureVNetConfig Updates the virtual network settings for a Windows Azure cloud service.
Set-AzureVNetGateway Enables or disables a Windows Azure Virtual Network Gateway.

Managing Network ACLs to Endpoints

Name Description
Get-AzureAclConfig Gets a configuration object for an access control list (ACL).
New-AzureAclConfig Creates a new, empty configuration object for an access control list (ACL).
Remove-AzureAclConfig Creates a configuration object for an access control list (ACL).
Set-AzureAclConfig Sets the configuration object for an access control list (ACL).

Deploying and Managing Cloud Services

Name Description
Add-AzureCacheWorkerRole Adds a dedicated cache worker role to the current service.
Add-AzureCertificate Uploads a service certificate for the specified cloud service.
Add-AzureDjangoWebRole Creates the required files and configuration (sometimes referred to as scaffolding) for a Python Django application.
Add-AzureNodeWebRole Creates required files and folders for a Node.js application.
Add-AzurePHPWebRole Creates the required files and configuration (sometimes referred to as scaffolding) for a PHP application.
Add-AzureWebRole Adds a web role.
Add-AzureNodeWorkerRole Creates the required files and folders for a Node.js application to be hosted in the cloud via node.exe
Add-AzurePHPWorkerRole Creates 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-AzureWorkerRole Creates required files and configuration (sometimes referred to as scaffolding) for a custom worker role.
Disable-AzureServiceProjectRemoteDesktop Disables remote desktop access to a cloud service.
Enable-AzureMemcacheRole Enable memcached for the specified web role, configured to communicate with the specified dedicated cache role.
Enable-AzureServiceProjectRemoteDesktop Enables remote desktop access to a cloud service.
Get-AzureAffinityGroup Returns an object that represents a Windows Azure affinity group.
Get-AzureCertificate Gets a certificate object from the specified Windows Azure service.
Get-AzureDeployment Gets details of a specified deployment.
Get-AzureOSVersion Lists the versions of the guest operating system that are currently available in Windows Azure.
Get-AzureRemoteDesktopFile Gets a remote desktop connection file (.RDP) for the specified Windows Azure virtual machine.
Get-AzureRole Returns a list of roles in your Windows Azure service.
Get-AzureService Returns an object with information about the cloud services for the current subscription.
Get-AzureServiceProjectRoleRuntime Get the runtimes available to install in a role.
Move-AzureDeployment Swaps the deployments in production and staging.
New-AzureAffinityGroup Creates a new affinity group for the current Windows Azure subscription.
New-AzureDeployment Creates a new deployment from a service comprising web roles and worker roles.
New-AzureRoleTemplate Creates web and worker role templates.
New-AzureService Creates a new Windows Azure service.
New-AzureServiceProject Creates the required files and configuration (sometimes referred to as scaffolding) for a new service.
Publish-AzureServiceProject Publish the current service to Windows Azure.
Remove-AzureAffinityGroup Deletes an affinity group in the specified subscription.
Remove-AzureCertificate Deletes the specified certificate from the Windows Azure service.
Remove-AzureDeployment Deletes the specified deployment of a Windows Azure cloud service.
Remove-AzureService Deletes the specified service from Windows Azure.
Reset-AzureRoleInstance Requests a reboot or reimage of a single role instance or all role instances of a specific role.
Save-AzureServiceProjectPackage Packages the service project into Windows Azure cloud package (*.cspkg).
Set-AzureAffinityGroup Updates the properties of a Windows Azure affinity group.
Set-AzureDeployment Sets status, upgrade mode, and configuration settings of a Windows Azure deployment.
Set-AzureRole Sets the number of instances of a Windows Azure role to run.
Set-AzureService Sets or updates the label and description of the specified Windows Azure service.
Set-AzureServiceProject Sets the default location, subscription, slot, and storage account for the current service.
Set-AzureServiceProjectRole Sets the number of instances or the runtime version of a role.
Set-AzureWalkUpgradeDomain Walks the specified upgrade domain.
Start-AzureEmulator Starts the compute and storage emulators.
Start-AzureService Starts the specified hosted service in Windows Azure.
Stop-AzureEmulator Stops the compute emulator.
Stop-AzureService Stops the current hosted service.
Test-AzureName Tests whether a Windows Azure service or storage name is already in use.

Deploying and Managing Websites

Name Description
Get-AzureWebsite Gets information about websites in Windows Azure associated with the current subscription.
Get-AzureWebsiteDeployment Gets the deployments for a website in Windows Azure.
Get-AzureWebsiteLocation Gets all available website locations.
New-AzureWebsite Create a new website to run in Windows Azure.
Remove-AzureWebsite Removes the specified website from Windows Azure.
Restart-AzureWebsite Stops and then restarts the specified website.
Restore-AzureWebsiteDeployment Redeploys a previous deployment of a website in Windows Azure.
Save-AzureWebsiteLog Downloads and saves the logs for a specified website.
Set-AzureWebsite Configures a website running in Windows Azure.
Show-AzurePortal Show the Windows Azure Management Portal.
Show-AzureWebsite Opens a browser on a specified website.
Start-AzureWebsite Starts the specified website.
Stop-AzureWebsite Stops the specified website.

Managing Service Bus

Name Description
Get-AzureSBLocation Gets the location of the Service Bus.
Get-AzureSBNamespace Gets the namespace.
New-AzureSBNamespace Creates a service namespace.
Remove-AzureSBNamespace Removes a service namespace
Enhanced by Zemanta

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.