Publish-AzureWebsiteProject

Publish a Visual Studio web project to a Microsoft Azure web site using WebDeploy.

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

Publish-AzureWebsiteProject
       -ProjectFile <String>
       [-Configuration <String>]
       [-ConnectionString <Hashtable>]
       [-SkipAppData]
       [-DoNotDelete]
       [-Name <String>]
       [-Slot <String>]
       [-Profile <AzureSMProfile>]
       [<CommonParameters>]
Publish-AzureWebsiteProject
       -Package <String>
       [-ConnectionString <Hashtable>]
       [-Tokens <String>]
       [-SetParametersFile <String>]
       [-SkipAppData]
       [-DoNotDelete]
       [-Name <String>]
       [-Slot <String>]
       [-Profile <AzureSMProfile>]
       [<CommonParameters>]

Description

Publish a Visual Studio web project to a Microsoft Azure web site using WebDeploy. It can either take a WebDeploy package and publish directly, or take a Visual Studio web project, build the project and publish. It can also replace the connection strings in the Web.config during publish.

Examples

Example 1

PS C:\> Publish-AzureWebsiteProject -Name site1 -ProjectFile .\WebApplication1.csproj -Configuration Debug

Build a Visual Studio web project with "Debug" configuration (meaning use Web.Debug.config) and publish to a Microsoft Azure Web Site using WebDeploy.

Example 2

PS C:\> Publish-AzureWebsiteProject -Name site1 -Package .\WebApplication1.zip

Publish a WebDeploy Package .zip file to a Microsoft Azure Web Site using WebDeploy.

Example 3

PS C:\> Publish-AzureWebsiteProject -Name site1 -Package .\WebApplication1

Publish a WebDeploy Package folder to a Microsoft Azure Web Site using WebDeploy.

Example 4

PS C:\> Publish-AzureWebsiteProject -Name site1 -ProjectFile .\WebApplication1.csproj -ConnectionString @{ DefaultConnection = "my connection string" }

Build a Visual Studio web project, overwrite the "DefaultConnection" connection string in Web.config and publish to a Microsoft Azure Web Site using WebDeploy.

Example 5

PS C:\> Publish-AzureWebsiteProject -Name site1 -ProjectFile .\WebApplication1.csproj -DefaultConnection "my connection string"

Build a Visual Studio web project, overwrite the "DefaultConnection" connection string in Web.config and publish to a Microsoft Azure Web Site using WebDeploy. Notice that -DefaultConnection is a dynamic parameter which gets added by parsing Web.config.

Parameters

-Configuration

The configuration used to build the Visual Studio web application project.

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

-ConnectionString

The connection strings to use for the deployment.

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

-DoNotDelete

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

-Name

The web site name.

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

-Package

The WebDeploy package folder for zip file of the Visual Studio web application project to be published.

Type:String
Position:Named
Default value:None
Required:True
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

-ProjectFile

The Visual Studio web application project to be published.

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

-SetParametersFile

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

-SkipAppData

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

-Slot

The web site slot name.

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

-Tokens

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