Skip to content

[BUG]: Azure App Service Deploy ignores DeployIisAppPath specified in Publish Profile #19596

Closed
@robinmira

Description

New issue checklist

Task name

Azure App Service Deploy

Task version

4.235.0

Issue Description

The Publish Profile Connection Type option of the Azure App Service deploy tool ignores the DeployIisAppPath specified in the publish profile and unsuccessfully tries to install to the "IIS Web Application Name" value specified in the *.SetParameters.xml file of the Web Deploy package, which defaults to Default Web Site.

Workarounds:

  • Build a custom artifact for each target app service.
  • Publish manually from VisualStudio
  • Copy the failed command line from the Azure App Service deploy log output and create a new PowerShell Script task with the following inline script and an extra "setParam" argument to update the value of "IIS Web Application Name":

"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -source:package='D:\a\r1\a\_application\web\Web.zip' -dest:auto,computerName="https://sanitized.scm.azurewebsites.net:443/msdeploy.axd?site=sanitized",userName="$sanitized",password="<password>",authtype="basic",includeAcls="False" -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:"D:\a\r1\a\_application\web\Web.SetParameters.xml" -enableRule:DoNotDeleteRule -retryAttempts:6 -retryInterval:10000 -setParam:"Name=""IIS Web Application Name"",value=sanitized"

The application name and password can also be added as scoped pipeline variables and passed through as environment variables:

&"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -source:package='D:\a\r1\a\_application\web\Web.zip' -dest:auto,computerName="https://$($Env:APPNAME).scm.azurewebsites.net:443/msdeploy.axd?site=$($Env:APPNAME)",userName="`$$($Env:APPNAME)",password="$($Env:APPPASS)",authtype="basic",includeAcls="False" -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:"D:\a\r1\a\_MiraHpc\web\Web.SetParameters.xml" -enableRule:DoNotDeleteRule -retryAttempts:6 -retryInterval:10000 -setParam:"Name=""IIS Web Application Name"",value=$($Env:APPNAME)"

This has the added benefit of hiding the password from the build logs.

Environment type (Please select at least one environment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

RTM

Operation system

Azure App Service

Relevant log output

2024-02-29T17:46:12.0672882Z  "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -source:package='D:\a\r1\a\_application\web\Web.zip' -dest:auto,computerName="https://sanitized.scm.azurewebsites.net:443/msdeploy.axd?site=sanitized",userName="$sanitized",password="<password>",authtype="basic",includeAcls="False" -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:"D:\a\r1\a\_application\web\Web.SetParameters.xml"  -enableRule:DoNotDeleteRule -retryAttempts:6 -retryInterval:10000
2024-02-29T17:46:12.5978693Z Info: Using ID '1f244be9-8c1e-4e17-abf4-fa2375d63db4' for connections to the remote server.
2024-02-29T17:46:12.8921750Z Info: Creating application (Default Web Site)
2024-02-29T17:46:14.9649322Z ##[error]Failed to deploy web package to App Service.
2024-02-29T17:46:14.9658176Z ##[error]Error Code: ERROR_USER_NOT_AUTHORIZED_FOR_CREATEAPP

Full task logs with system.debug enabled


Repro steps

steps:
- task: AzureRmWebAppDeployment@4
  displayName: 'Deploy Azure App Service'
  inputs:
    ConnectionType: PublishProfile
    PublishProfilePath: '$(System.DefaultWorkingDirectory)/_application/profiles/Web/Properties/PublishProfiles/sanitized - Web Deploy.pubxml'
    PublishProfilePassword: '<password>'
    packageForLinux: '$(System.DefaultWorkingDirectory)/_application/web/Web.zip'

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions