Get-AzureWebsite

Gets Azure websites in the current subscription.

Note

The cmdlets referenced in this documentation are for managing legacy Azure resources that use Azure Service Manager (ASM) APIs. This legacy PowerShell module isn't recommended when creating new resources since ASM is scheduled for retirement. For more information, see Azure Service Manager retirement.

The Az PowerShell module is the recommended PowerShell module for managing Azure Resource Manager (ARM) resources with PowerShell.

Syntax

Get-AzureWebsite
   [-Name <String>]
   [-Slot <String>]
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]

Description

The Get-AzureWebsite cmdlet gets information about Azure websites in the current subscription.

By default, Get-AzureWebsite gets all Azure websites in the current subscription and returns an object that provides basic information about the sites. When you use the Name parameter, Get-AzureWebsite returns an object with extensive information, including configuration details.

The current subscription is the subscription that is designated as "current." To find the current subscription, use the Current parameter of the Get-AzureSubscription cmdlet. To change the current subscription, use the Select-AzureSubscription cmdlet.

This topic describes the cmdlet in the 0.8.10 version of the Microsoft Azure PowerShell module. To get the version of the module you're using, in the Azure PowerShell console, type (Get-Module -Name Azure).Version.

Examples

Example 1: Get all websites in the subscription

PS C:\> Get-AzureWebsite

This command gets all Azure websites in the current subscription.

Example 2: Get a website by name

PS C:\> Get-AzureWebsite -Name ContosoWeb

This command gets detailed information about the ContosoWeb Azure website, including configuration information. When you use the Name parameter, Get-AzureWebsite returns a SiteWithConfig object with extended information about the website.

Example 3: Get detailed information about all websites

PS C:\> Get-AzureWebsite | ForEach-Object {Get-AzureWebsite -Name $_.Name}

This command gets detailed information about all websites in the subscription. It uses a Get-AzureWebsite command to get all websites and then uses the ForEach-Object cmdlet to get each website by name.

Example 4: Get information about a deployment slot

PS C:\> Get-AzureWebsite -Name ContosoWeb -Slot Staging

This command gets the Staging deployment slot of the ContosoWeb website. Deployment slots let you test different versions of your Azure website without releasing them to the public.

Example 5: Get website instances

PS C:\>(Get-AzureWebsite -Name ContosoWeb).Instances

InstanceId
----------
2d8e712fb8f85d061c30fd793a534e6700a175f9a9ab12ca55cb3b0edfcc10ee
5834916b8cef49249b18187708223a33fbbc4352d33b48369f3166644bdd3445

PS C:\>(Get-AzureWebsite -Name ContosoWeb).Instances.Count
2

The commands in this example use the Instances property of an Azure website to get information about currently running website instances. The Instances property was added to the SiteWithConfig object in version 0.8.3 of the Azure module.

The first command gets the instance IDs of all currently running instances of a website. The second command gets the number of running instances of the website. You can use the Count property on any array.

Parameters

-Name

Gets detailed configuration information about the specified website. Enter the name of one website in the subscription. By default, Get-AzureWebsite gets all websites in the current subscription. The Name value does not support wildcard characters.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Profile

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

Type:AzureSMProfile
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Slot

Gets the specified deployment slot of the website. Enter the slot name, such as "Staging" or "Production". For more information about deployment slots, see Staged Deployment on Microsoft Azure Web Siteshttps://azure.microsoft.com/en-us/documentation/articles/web-sites-staged-publishing/. To add a deployment slot to an existing Azure website, use the Set-AzureWebsite cmdlet.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

Inputs

None

You can pipe input to this cmdlet by property name, but not by value.

Outputs

Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities.Site

By default, Get-AzureWebsite returns an array of Site objects.

Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities.SiteWithConfig

When you use the Name parameter, Get-AzureWebsite returns a SiteWithConfig object.