Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
Publish-AzWebApp
- Module:
- Az.Websites Module
Deploys an Azure Web App from a ZIP, JAR, or WAR file using zipdeploy.
Syntax
FromWebApp (Default)
Publish-AzWebApp
[-WebApp] <PSSite>
[-ArchivePath <String>]
[-ArchiveURL <String>]
[-Type <String>]
[-Clean]
[-Async]
[-Restart]
[-TargetPath <String>]
[-PullIdentity <String>]
[-IgnoreStack]
[-Reset]
[-Force]
[-AsJob]
[-Timeout <Double>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[-AcquirePolicyToken]
[-ChangeReference <String>]
[<CommonParameters>]
FromResourceName
Publish-AzWebApp
[-ResourceGroupName] <String>
[-Name] <String>
[[-Slot] <String>]
[-ArchivePath <String>]
[-ArchiveURL <String>]
[-Type <String>]
[-Clean]
[-Async]
[-Restart]
[-TargetPath <String>]
[-PullIdentity <String>]
[-IgnoreStack]
[-Reset]
[-Force]
[-AsJob]
[-Timeout <Double>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[-AcquirePolicyToken]
[-ChangeReference <String>]
[<CommonParameters>]
Description
The Publish-AzWebApp cmdlet uploads content to an existing Azure Web App. The content should be packaged in a ZIP file if using stacks such as .NET, Python, or Node, or a WAR or JAR file if using Java. The content should be pre-built and ready-to-run without any additional build steps during deployment. This cmdlet uses the Kudu zipdeploy and wardeploy features to deploy content. Refer to the Kudu wiki for details about how zipdeploy and wardeploy work, and how to properly package a web app for deployment. https://aka.ms/kuduzipdeploy and https://aka.ms/kuduwardeploy contain helpful details about zipdeploy and wardeploy.
Examples
Example 1
Publish-AzWebApp -ResourceGroupName Default-Web-WestUS -Name MyApp -ArchivePath C:\project\app.zip
Uploads the contents of app.zip to the web app named MyApp belonging to the resource group Default-Web-WestUS.
Example 2
Publish-AzWebApp -ResourceGroupName ContosoRG -Name ContosoApp -Slot Staging -ArchivePath C:\project\javaproject.war
Uploads the contents of javaproject.war to the Staging slot of the web app named ContosoApp belonging to the resource group ContosoRG.
Example 3
$app = Get-AzWebApp -ResourceGroupName ContosoRG -Name ContosoApp
Publish-AzWebApp -WebApp $app -ArchivePath C:\project\app.zip -AsJob
Uploads the contents of app.zip to the web app named ContosoApp belonging to the resource group ContosoRG. The cmdlet will be run in a background job.
Example 4
$app = Get-AzWebApp -ResourceGroupName ContosoRG -Name ContosoApp
$app | Publish-AzWebApp -ArchivePath C:\project\java_app.jar
Example 5
$app = Get-AzWebApp -ResourceGroupName ContosoRG -Name ContosoApp
Publish-AzWebApp -WebApp $app -ArchivePath C:\project\app.zip -Force
Uploads the contents of java_app.jar to the web app named ContosoApp belonging to the resource group ContosoRG. If -Force is not specified it will prompt for the confirmation before the contents will be deployed.
Example 6
$app = Get-AzWebApp -ResourceGroupName ContosoRG -Name ContosoApp
Publish-AzWebApp -WebApp $app -ArchivePath C:\project\app.zip -Timeout 300000 -Force
Uploads the contents of java_app.jar to the web app named ContosoApp belonging to the resource group ContosoRG. User can Sets the timespan in Milliseconds to wait before the request times out. If -Force is not specified it will prompt for the confirmation before the contents will be deployed.
Parameters
-AcquirePolicyToken
Acquire an Azure Policy token automatically for this resource operation.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ArchivePath
The path of the archive file. ZIP, WAR, and JAR are supported.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ArchiveURL
URL of the artifact. The webapp will pull the artifact from this URL. Ex: "http://mysite.com/files/myapp.war
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-AsJob
Run cmdlet in the background
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Async
The artifact is deployed asynchronously. (The command will exit once the artifact is pushed to the web app.)
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ChangeReference
The change reference resource ID for this resource operation.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Clean
Cleans the target directory prior to deploying the file(s).
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | cf |
Parameter sets
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Parameter properties
| Type: | IAzureContextContainer |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | AzContext, AzureRmContext, AzureCredential |
Parameter sets
-Force
Forcefully Remove Option
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-IgnoreStack
Disables any language-specific defaults
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Name
The name of the web app.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-PullIdentity
AAD identity used for pull based deployments. 'system' will use the app's system assigned identity. An user assigned identity can be used by providing the client ID. Only available for Windows WebApps. Support for Linux WebApps coming soon.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Reset
Reset Java web apps to default parking page
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ResourceGroupName
The name of the resource group.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Restart
The web app will be restarted following the deployment. Set this to false if you are deploying multiple artifacts and do not want to restart the site on the earlier deployments.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Slot
The name of the web app slot.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-TargetPath
Absolute path that the artifact should be deployed to.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Timeout
Sets the timespan in Milliseconds to wait before the request times out.
Parameter properties
| Type: | Double |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Type
Used to override the type of artifact being deployed.
Parameter properties
| Type: | String |
| Default value: | None |
| Accepted values: | war, jar, ear, zip, static |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-WebApp
The web app object
Parameter properties
| Type: | PSSite |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | wi |
Parameter sets
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.
Inputs
String
PSSite
Outputs
PSSite
Azure PowerShell
Feedback
Was this page helpful?
