Edit

Share via


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

ProjectFile

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

Package

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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ProjectFile
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ConnectionString

The connection strings to use for the deployment.

Parameter properties

Type:Hashtable
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-DoNotDelete

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.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

The web site name.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Package

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Package
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments: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.

Parameter properties

Type:AzureSMProfile
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ProjectFile

The Visual Studio web application project to be published.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ProjectFile
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-SetParametersFile

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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Package
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SkipAppData

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.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Slot

The web site slot name.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Tokens

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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Package
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.