Howdy, Cloud Adventurer!

You’ve stumbled across the Microsoft Azure Web Sites Cheat Sheet – The quickest reference for getting to know Microsoft Azure Web Sites on the web. If you’re looking for some tutorials on how to develop solutions on Microsoft Azure Web Sites check out the Microsoft Azure product site or the Microsoft Azure Training Kit.

Browse around this one page reference for information on command-line tools for managing your Microsoft Azure Web Sites. Take a quick look at the features that are offered on Microsoft Azure Web Sites then start exploring the wonderful world of Microsoft Azure!

Try Microsoft Azure Web Sites today for free!

Features

Environment

Disable Server Affinity

By default, Azure Websites comes preconfigured with Session affinity, which in many cases allows developers perform a very simple migration of their applications to cloud. This is because there is no need to worry about centralizing the session state of your application as a user will be redirected back to the same server on each subsequent request.

Some applications, however, may not require session affinity and it would be better to turn off the session affinity in Azure Websites. This can be achieved by adding the following to the web.config file.

Filtering Traffic by IP

Based on your web application, you may want to restrict access to it. Access can be restricted by using the <ipSecurity> element and providing a list of IP address to allow.

The full documentation on the <ipSecurity> element is available on IIS Configuration Reference.

Dynamic IP Restrictions

Dynamic IP Restrictions enable you to block access to your website when based on an interval of requests (i.e. Potential DDoS Attack). This can be achieved in a variety of ways as outlined in the example below.

The full documentation on the <dynamicIpSecurity> element is available on IIS Configuration Reference.

Auto-Heal

You know those bugs where the only way to fix them is to restart the server every so often? There’s a web.config setting for that! Microsoft Azure Websites have the ability to auto-heal based on a number of different triggers, i’ve outlined some of them in the example below.

HTTP Compression

Some big wins come in small packages, enabling HTTP Compression in your Website can help decrease your users mobile bill and wait time while loading your Web Application.

Enable HTTP Verbs

When building out HTTP based APIs it is nearly impossible to enable functionality without being able to use certain HTTP Verbs such as PUT and DELETE.

.NET

PHP

Deployment

There are a number of ways to deploy your applications to Microsoft Azure Web Sites, there are also a number of ways to tie into the deployment process to aid you in Automation, Configuration, or Diagnosing issues with your deployment.

Supported Deployment Types

Deployment Tools

Kudu

Install Kudu

Windows Server

That's right, Kudu isn't exclusively for Microsoft Azure. Read the docs on How to Deploy Kudu on Windows Server 2012.

Self-Host on Microsoft Azure

Have you forked kudu for your own purposes? Here's how you can deploy your custom fork of Kudu to Azure

Kudu is the central nervous system of a Microsoft Azure Web Site; it handles the Git integration to a Web Site as well as provides an API endpoint for programmatic access to app settings, deployment information, files, active processes, runtime versions, source control information, web hooks and web jobs. Kudu, itself, is a Site Extension which is provided with ever Web Site, you can access it by using the Source Control Management entry point https://<your-website-name>.scm.azurewebsites.net

Kudu Dash(board)

The Kudu dashboard is the first page you will encounter on the SCM entry point, it displays information pertaining to your Web Site such as the build number of Kudu which is running, tge current uptime of your site (this could display a value as low as a couple of seconds as your site may have been deallocated due to inactivity, unless the site has Always-On enabled).

Environment

The Environment tab in Kudu Dash shows some very valuable information including System Information, App Settings, Connection Strings, Environment Variables, PATH, HTTP Headers and Server Variables.

Debug Console

The Debug Console gives file explorer and graphical KuduExec experience which enables you to run command line tools against the Web Site.

Diagnostic Dump

Diagnostic Dump provides a zip file of all of the Diagnostic Data which is enabled under the Application Diagnostics header in the CONFIGURE tab of the Web Site.

Log Stream
Web Server Logging must be enabled for the Microsoft Azure Web Site or this page will fail to load.

Log Stream long-polling process which provides logging data from your Web Site if Web Server Logging is enabled under the Site Diagnostics header in the CONFIGURE tab of the Web Site.

Web Hooks

Allows URLs to be registered as Web Hooks. Information will be posted to the URL when events occur.

Hooking the Deployment

KuduExec

Get the Tools

Command Line

Prerequisites: Node.js
npm install kuduexec -g

Microsoft Azure Web Sites is a shared environment. The context of command line access is contained within a sandbox.

KuduExec enables command-line access to a Microsoft Azure Web Site. Simply call KuduExec and pass in the Source Control Management (scm) endpoint of the website as the first parameter.

kuduexec https://[site-name].scm.azurewebsites.net
Username: [deployment-user]
Password: [deployment-pass]

KuduSync

Get the Tools

Command Line

Prerequisites: Node.js
npm install kudusync -g

KuduSync is a tool for syncing files for deployment, will only copy changed files and delete files that doesn’t exists in the destination but only if they were part of the previous deployment.

KuduSync is responsible for file synchronization during deployment. It is called at the end of the default deployment process (you can customize the deployment script) to move files between the %DEPLOYMENT_SOURCE% folder and the %DEPLOYMENT_TARGET%.
websites-dev$ kudusync [options]
command options description
-h, --help
output usage information
-V, --version
output the version number
-f, --fromDir <dir path>
Source directory to sync
-t, --toDir <dir path>
Destination directory to sync
-n, --nextManifest <manifest file path>
Next manifest file path
-p, --previousManifest [manifest file path]
Previous manifest file path
-i, --ignore [patterns]
List of files/directories to ignore
-q, --quiet
No logging
-v, --verbose [maxLines]
Verbose logging with maximum number of output lines
-w, --whatIf
only log without actual copy/remove of files
--perf
Print out the time it took to complete KuduSync operation
 

Language Guide

PHP

So, you fancy programming PHP do ya? Well, here are some tips specifically for you.

PHP Runtimes

Microsoft Azure Web Sites has a selection of default installed PHP Runtimes, however, the option is still available to bring your own runtime if a specific version of PHP is required.

PHP WinCache
5.3.19 1.3.4.0
5.4.9
5.5.3 1.3.5

Bring your own Runtime

Warning! Bring your own Runtime is available to enable you to bring a specific version of PHP to run your Web Application. This option is enabled for Advanced Users only.
Bring your own runtime disables the default PHP Runtime in Microsoft Azure Web Sites, so be sure to upload your own php.ini. Mmm, Yeah, I'm going to have to go ahead and ask you to set fastcgi.impersonate = 1 and fastcgi.logging = 0, too. Grrrreat.

In order to do this there are a few steps involved:

  1. Download the NTS PHP runtime
	<script src="https://gist.github.com/SyntaxC4/0d7185b30acf477c2033.js?file=InstallPHP.sh"> </script>
  1. Configure an Handler Mapping via the Microsoft Azure Management Portal; or
    • Login to the Microsoft Azure Management Portal
    • Select your Web Site from the list
    • Navigate to the CONFIGURE tab
    • Scroll to the Handler Mappings section
    • Flll the boxes as follows:
	<table class="table table-bordered"><tr class="active"><th>Extension</th><th>Script Processor Path</th><th>Additional Arguments (Optional)</th></tr><tr><td><dfn title="All PHP files">*.php</dfn></td><td>D:\home\site\wwwroot\bin\php\php-cgi.exe</td></tr></table>
  1. Configure a Handler Mapping via the command line:
**Cross Platform Command Line Tools**

<script src="https://gist.github.com/SyntaxC4/0d7185b30acf477c2033.js?file=addAzureWebsitePHPHandler.sh"> </script>

**PowerShell Cmdlets**

<script src="https://gist.github.com/SyntaxC4/0d7185b30acf477c2033.js?file=New-AzureWebsitePHPHandler.ps1"> </script>

Default PHP Extensions

To enable extensions in Microsoft Azure Web Sites follow the directions under the Enable PHP Extensions section.
If you need to enable default PHP extensions that are not highlighted below, you must upload them to your Microsoft Azure Web Site then enable as instructed in Enable PHP Extensions. Loading default extensions in this way is required as extensions cannot be dynamically loaded in the .user.ini file.
  • php_bz2.dll
  • php_com_dotnet.dll
  • php_curl.dll
  • php_enchant.dll
  • php_exif.dll
  • php_fileinfo.dll
  • php_gd2.dll
  • php_gettext.dll
  • php_gmp.dll
  • php_imap.dll
  • php_interbase.dll
  • php_intl.dll
  • php_ldap.dll
  • php_mbstring.dll
  • php_mysql.dll
  • php_mysqli.dll
  • php_oci8.dll
  • php_oci8_11g.dll
  • php_openssl.dll
  • php_pdo_firebird.dll
  • php_pdo_mysql.dll
  • php_pdo_oci.dll
  • php_pdo_odbc.dll
  • php_pdo_pgsql.dll
  • php_pdo_sqlite.dll
  • php_pgsql.dll
  • php_shmop.dll
  • php_snmp.dll
  • php_soap.dll
  • php_sockets.dll
  • php_sqlite3.dll
  • php_sybase_ct.dll
  • php_tidy.dll
  • php_wincache.dll
  • php_xmlrpc.dll
  • php_xsl.dll

Enabling PHP Extensions

Extensions can be enabled by adding App Settings to your Web Site with the following reserved app setting keys.

Key Value Description
PHP_EXTENSIONS
comma delimited list of relative paths to DLLs
bin\ext\php_mongo.dll,bin\ext\php_xdebug.dll
used for loading PHP extensions with the built in versions of PHP
PHP_ZENDEXTENSIONS
comma delimited list of relative paths to DLLs
bin\ext\php_xdebug.dll,bin\ext\ZendLoader.dll
used for loading zend extensions with the built in versions of PHP

Microsoft Azure CLI Tools (Cross Platform 0.7.0)

The Microsoft Azure cross platform command line tools enable the power of the Microsoft Azure Management Portal at the tip of your fingers on Linux, OSX or Windows. This guide details the command line options for creating, configuring and scaling Microsoft Azure Web Sites.

Getting Setup

  1. Run azure account download to download a .publishsettings file which lists your subscriptions
  2. Run azure account import <path-to-publishsettings-file> to import your subscriptions to be available to the tools
  3. .publishsettings files may contain multiple subscriptions, run azure account list to identify which subscriptions were imported
    • If you have multiple subscriptions, run azure account set <subscription-name> to select the subscription to use
  4. To remove all of your subscriptions from the tools, run azure account clear

General Web Site Commands

General commands for Microsoft Azure Web Sites include the ability to create or delete a Web Site in Microsoft Azure. In addition, they allow you to control they underlying Web Server (IIS) with actions such as starting and stopping the site.

websites-dev$ azure site
command options description
browse [options] [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
launch the website [name] in the default browser
create [options] [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
-l, --location <location>
the geographic region to create the website
--hostname
custom hostname to associate to the web site
--git
configure git on web site and local folder
--gitusername
the publishing username for git
--github
configure github on web site and local folder
--githubusername <username>
the github username
--githubpassword <password>
the github password
--githubrepository
the full name (eg. username/repository) of the github repository
create a new, or associate a local directory to an existing web site
delete [options] [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
-q, --quite
quite mode, do not ask for confirmation
delete the web site [name]
set [options] [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
--net-version <net-version>
The .NET version. Valid options are v3.5 and v4.5
--php-version <php-version>
The PHP version. Valid options are off, v5.3 and v5.4
--platform <platform>
the platform. Valid options are x86 and x64
-w, --web-socket
use this flag to enable web sockets
-W, --disable-web-socket
use this flag to disable web sockets
-r, --remote-debugging
use this flag to enable remote debugging
-R
-d, --remote-debugging-version <remote-debugging-version>
the version of remote debugging. It's either VS2012 or VS2013. This parameter is only valid when remote debugging is on.
-m, --managed-pipeline-mode <managed-pipeline-mode>
the mode for managed pipeline. valid values are Classic and Integrated.
-s, --subscription <id>
execute command against the provided subscription
Sets configuration options for your web site [name]
show [options] [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
-d, --details
show additional site details
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
Show details for a web site
start [options] [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
start the Internet Information Services (IIS) site
stop [options] [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
stop the Internet Information Services (IIS) site
swap [options] [name]

new

-h, --help
show usage information
-s, --subscription <id>
execute command against the provided subscription
-v, --verbose
use verbose output
--json
use json output
-q, --quite
quite mode, do not ask for confirmation
swaps the staging site into production
restart [options] [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
stop, then start the Internet Information Services (IIS) site

Web Site Deployment Commands

websites-dev$ azure site deployment
command options description
deploymentscript [options]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
-r, --repositoryRoot [dir path]
The root path for the repository (default: .)
--aspWAP projectFilePath>
Create a deployment script for .NET web application, specify the project file path
--aspWebSite
Create a deployment script for asp website
--node
Create a deployment script for node.js website
--php
Create a deployment script for php website
--python
Create a deployment script for python website
--basic
Create a deployment script for any other website
-s, --solutionFile [file path]
The solution file path (sln)
-p, --sitePath [directory path]
The path to the site being deployed (default: same as repositoryRoot)
-t, --scriptType [batch|bash]
The script output type (default: batch)
-o, --outputPath <output path>
The path to output generated script (default: same as repository root)
-y, --suppressPrompt
Suppresses prompting to confirm you want to overwrite an existing destination file
--no-dot-deployment
Do not generate the .deployment file.
--no-solution
Do not require a solution file path (only for --aspWAP otherwise ignored).
Generate custom deployment script
list [options] [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
-m, -max <count>
limit the maximum number of results
lists deployed site
show [options] <commitId> [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
-d, --details
display log details
shows details of the git deployment with the particular [commitid]
redeploy [options] <commitId> [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
-q, --quite
quite mode, do not ask for confirmation
set specified [commitid] as the active deployment
github [options] [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
--githubusername <username>
the github username
--githubpassword <password>
the github password
--githubrepository
the full name (eg. username/repository) of the github repository
setup a github service hook for specified web site
user set [options] [username] [pass]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
-u, --username <gitUsername>
The new git username
-p, --pass <gitPassword>
The new git password
Sets the deployment credentials

Web Site Repository Commands

websites-dev$ azure site repository
command options description
branch <branch> [name] [options]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
set the branch in which to use for website deployment
delete [name] [options]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
-q, --quite
quite mode, do not ask for confirmation
delete the remote git repository for the web site
sync [name] [options]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
Sync your repository

Web Site Location Commands

websites-dev$ azure site location
command options description
list [options]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
enumerate the data centers in which web sites can be created

Web Site Configuration Commands

App Settings Configuration

websites-dev$ azure site appsetting
command options description
list [options] [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
Show your site application settings
add [options] <keyvaluepair> [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
Adds an application setting for your site [semi-colon (;) delimitied]
delete [options] <key> [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-q, --quite
quite mode, do not ask for confirmation
-s, --subscription <id>
execute command against the provided subscription
Deletes an application setting for your site
show [options] <key> [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
Shows an application setting for your site

SSL Certificate Configuration

websites-dev$ azure site cert
command options description
list [options] [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
-s, --subscription <id>
execute command against the provided subscription
Show your site certificates
add [options] <certificate-path> [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
-s, --subscription <id>
execute command against the provided subscription
-k, --key <key>
The certificate key
Adds a site certificate in pfx format
delete [options] <thumbprint> [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
-s, --subscription <id>
execute command against the provided subscription
-q, --quite
quite mode, do not ask for confirmation
Deletes a site certificate
show [options] <thumbprint> [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
-s, --subscription <id>
execute command against the provided subscription
Shows a site certificate

Site Configuration

Warning!

azure site config has been deprecated and will be removed in a future release. Please use azure site appsetting instead.

websites-dev$ azure site config
command options description
list [options] [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
-s, --subscription <id>
execute command against the provided subscription
list the app setting for the specified site
add [options] <keyvaluepair> [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
-s, --subscription <id>
execute command against the provided subscription
add an app setting to the specified web site
clear [options] <key> [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
-s, --subscription <id>
execute command against the provided subscription
removes an app setting from the specified web site
get [options] <key> [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
-s, --subscription <id>
execute command against the provided subscription
gets the current value of web site app setting

Connection String Configuration

websites-dev$ azure site connectionstring
command options description
list [options] [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
Show your site connection strings
add [options] <connectionname> <value> <type> [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
-c, --connectionname <connectionname>
the connection string name
-v, --value <value>
the connection string value
-t, --type <type>
the connection string type
Adds a connection string to your site
delete [options] <connectionname> [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
-c, --connectionname <connectionname>
the connection string name
-q, --quite
quite mode, do not ask for confirmation
Deletes a connection string for your site
show [options] <connectionname> [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
-c, --connectionname <connectionname>
the connection string name
Shows a connection string for your site

Default Document Configuration

websites-dev$ azure site defaultdocument
command options description
list [options] [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
Show your site default documents
add [options] [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
-d, --document <document>
the new default document
-p, --position <position>
the position of the new default document
Add a site default document (appended to list by default)
delete [options] [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
-d, --document <document>
the new default document
-q, --quite
quite mode, do not ask for confirmation
Deletes a site default document

Custom Domain Configuration

websites-dev$ azure site domain
command options description
list [options] [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
Show your site domains
add [options] [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
-d, --domain <domain>
the domain
Add a site domain
delete [options] [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
-d, --domain <domain>
the domain
-q, --quite
quite mode, do not ask for confirmation
Deletes a site domain

HTTP Handler Configuration

websites-dev$ azure site handler
command options description
list [options] [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
Show your site handler mappings
add [options] [extension] [processor] [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
-e, --extension <extension>
The extension to map to a handler
-p, --processor <processor>
The path to the script processor (executable that will process the file given by the extension)
-a, --arguments <arguments>
The additional arguments
Add a handler mapping
delete [options] [extension] [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
-e, --extension <extension>
The extension to map to a handler
-q, --quite
quite mode, do not ask for confirmation
Deletes a site handler mapping

Web Job Configuration

websites-dev$ azure site job
command options description
delete [options] <jobName> <jobType> [name]

new

-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--job-name <job-name>
required. The name of the webjob.
--job-type <job-type>
required. The type of the webjob. Valid value is "triggered" or "continuous".
-q, --quite
quite mode, do not ask for confirmation
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
Delete a web job
history list [options] [jobName] [name]

new

-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--job-name <job-name>
required. The name of the webjob.
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
List all the triggered web jobs runs under a web site
history show [options] [jobName] [runId] [name]

new

-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--job-name <job-name>
required. The name of the webjob.
--run-id <run-id>
optional. The id of the run history. If not specified, show the latest run.
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
Get the details for a triggered web jobs run under a web site
list [options] [name]

new

-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--job-type <job-type%gt;
optional. The type of the webjob. Valid value is "triggered" or "continuous". By default return webjobs of all types.
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
List all the web jobs under a web site
show [options] <jobName> <jobType> [name]

new

-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--job-name <job-name>
required. The name of the webjob.
--job-type <job-type>
required. The type of the webjob. Valid value is "triggered" or "continuous".
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
Show details of a specific web job
start [options] <jobName> <jobType> [name]

new

-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--job-name <job-name>
required. The name of the webjob.
--job-type <job-type>
required. The type of the webjob. Valid value is "triggered" or "continuous".
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
Start a web job
stop [options] <jobName> <jobType> [name]

new

-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--job-name <job-name>
required. The name of the webjob.
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
Stop a web job. Only continuous jobs can be stopped
upload [options] <jobName> <jobType> <jobFile> [name]

new

-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--job-name <job-name>
required. The name of the webjob.
--job-type <job-type>
required. The type of the webjob. Valid value is "triggered" or "continuous".
--job-file <job-file>
required. the job file.
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
Upload a web job

Logging Configuration

websites-dev$ azure site log
command options description
download [options] [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
-o, --output <path>
output path, default is local folder
Download diagnostic log
tail [options] [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
-p, --path <path>
the log path under LogFiles folder
-f, --filter <filter>
filter matching line
--log
write output as log data
live diagnostic log
set [options] [name]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
-a, --application
Use this flag to enable application diagnostics
-A, --disable-application
Use this flag to disable application diagnostics
-w, --web-server-logging
Use this flag to enable web server logging
-W, --disable-web-server-logging
Use this flag to disable web server logging
-e, --detailed-error-messages
Use this flag to enable detailed error messages
-E, --disabled-detailed-error-messages
Use this flag to disable detailed error messages
-f, --failed-request-tracing
Use this flag to enable failed request tracing
-F, --disable-failed-request-tracing
Use this flag to disable failed request tracing
-o, --output <output>
Takes file or storage. When -a is specified, use this parameter to specify the output of the log
-l, --level
Takes error, warning, verbose or info. When -a is specified, use this parameter to specify the log level. (default is error)
-t, --storage-account
Use this parameter to specify the storage account where the logs will be stored
Configure diagnostics

Scale Configuration

websites-dev$ azure site scale
command options description
mode [name] <mode>
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
--mode <mode>
The mode of the site (available are: free, shared and standard)
Sets the web site mode
instances [name] <instances> [size]
-h, --help
show usage information
-v, --verbose
use verbose output
--json
use json output
--slot <slot>
the name of the slot
-s, --subscription <id>
execute command against the provided subscription
--instances <instances>
The number of instances
--size <size>
The size of the instances (available are: small, medium and large)
Sets the web site number of instances

Microsoft Azure CLI Tools (PowerShell 0.6.18)

The Microsoft Azure PowerShell Cmdlets enable the power of the Microsoft Azure Management Portal straight from the PowerShell command window. This guide details the command line operations for interacting with Microsoft Azure Web Sites.

Getting Setup

  1. Run Get-AzurePublishSettingsFile to download a .publishsettings file which lists your subscriptions
  2. Run Import-AzurePublishSettingsFile <path-to-publishsettings-file> to make your subscriptions available to the PowerShell command-line.
  3. .publishsettings files may contain multiple subscriptions, run Get-AzureSubscription to identify which subscriptions were imported.
  4. Run Select-AzureSubscription <Name> to select the subscription to use
  5. To remove all of your subscriptions from PowerShell, run Get-AzureSubscription | Remove-AzureSubscription

Web Site Management

These Cmdlets enable the ability to create new Microsoft Azure Web Sites with options to associate a local Git or GitHub repository to your site. The Cmdlets also allow the deletion of Web Sites from your subscription.

PS > New-AzureWebSite
parameter description parameter help
-Name <string>
The name of the Web Site
Required?
false
Position?
1
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false
-Location <string>
The data center where the website should be deployed
Required?
false
Position?
2
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false
-HostName <string>
An alternative hostname for the new azure website.
Required?
false
Position?
3
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false
-PublishingUsername <string>
The username you have specified in the Microsoft Azure Portal for Git deployment
Required?
false
Position?
4
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false
-Git
Set up a local git repository and link it to the website. If specified, this will set up a git repository in the local directory and add a remote named 'azure' that links to the website in Microsoft Azure.
Required?
false
Position?
named
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false
-GitHub
If enabled, link this website with an existing Github repository. Commits to the Giuthub repository will be pushed to the website in Microsoft Azure.
Required?
false
Position?
named
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false
-GitHubCredentials <PSCredential>
The username and password credentials used to connect to Github
Required?
false
Position?
named
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false
-GitHubRepository <string>
The full name of the Github repository to link to this website. For example, myaccount/myrepo
Required?
false
Position?
named
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false
PS > Remove-AzureWebSite
parameter description parameter help
-Name <string> The name of the Web Site
Required?
false
Position?
1
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false
-Force If specified, bypass confirmation prompts and delete the specified website
Required?
false
Position?
named
Default value
Accept pipeline input?
false
Accept Wildcard characters?
false

Web Site Configuration

These Cmdlets enable the ability to list or set configuration settings in Microsoft Azure Web Sites.

PS > Get-AzureWebSite
parameter description parameter help
-Name <string> The name of the Web Site
Required?
false
Position?
1
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false
PS > Set-AzureWebSite
parameter description parameter help
-Name <string> The name of the Web Site
Required?
false
Position?
1
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false
-SiteWithConfig <SiteWithConfig> The configuration used by the website
Required?
false
Position?
2
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false
-NumberOfWorkers <Int32> The number of worker processes executing the website
Required?
false
Position?
named
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false
-DefaultDocuments <String[]> The documents that are automatically displayed when browsing the website
Required?
false
Position?
named
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false
-NetFrameworkVersion <string> The version of the .Net Framework required by the website
Required?
false
Position?
named
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false
-PhpVersion <string> The PHP version required by the website
Required?
false
Position?
named
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false
-RequestTracingEnabled [<Boolean>] Determines whether request tracing is enabled for the website
Required?
false
Position?
named
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false
-HttpLoggingEnabled [<Boolean>] Determines whether http logging is enabled for the website
Required?
false
Position?
named
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false
-DetailedErrorLoggingEnabled [<Boolean>] Determines whether detailed iis errors are logged for the website
Required?
false
Position?
named
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false
-HostNames <string[]> The fully qualified hostnames that can be used to access the website
Required?
false
Position?
named
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false
-AppSettings <Hashtable> The environment variables that will be used by the website
Required?
false
Position?
named
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false
-Metadata <NameValuePair> The Metadata for the website
Required?
false
Position?
named
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false
-ConnectionStrings <ConnStringPropertyBag> The connection strings used by the website
Required?
false
Position?
named
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false
-HandlerMappings <HandlerMapping[]> The Handler Mappings used by the website
Required?
false
Position?
named
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false
-PassThru <Switch> When specified, a boolean value is returned
Required?
false
Position?
named
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false

Web Site Operations

These Cmdlets enable the ability to start, stop or restart a Web Site. The Cmdlets also launch the Web Site in the default web browser.

PS > Start-AzureWebSite
parameter description parameter help
-Name <string> The name of the Web Site
Required?
false
Position?
1
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false
PS > Stop-AzureWebSite
parameter description parameter help
-Name <string> The name of the Web Site
Required?
false
Position?
1
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false
PS > Restart-AzureWebSite
parameter description parameter help
-Name <string> The name of the Web Site
Required?
false
Position?
1
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false
PS > Show-AzureWebSite
parameter description parameter help
-Name <string> The name of the Web Site
Required?
false
Position?
1
Default value
Accept pipeline input?
true
Accept Wildcard characters?
false