Azure-pipelines-tasks: IIS Web App Manage - Error when using double back slash in Physical Path

Created on 20 May 2020  路  16Comments  路  Source: microsoft/azure-pipelines-tasks

Required Information

Question, Bug, or Feature?
Type: Bug

Enter Task Name: IIS Web App Manage

Environment

  • Server - Azure Pipelines
  • Account Name: gary.[email protected]
  • Project Name: tdyapp

  • If using Azure Pipelines, provide the account name, team project name, build definition name/build number:

    • Project Name: tdyapp
    • Build Definition Id: 12
    • Build Definition Name: Alpha - Rolling Release
    • Build Number: Release-21
  • Agent - Hosted or Private: Private

  • Agent Version: 2.168.2
  • Agent OS: Windows_NT
  • OS of machine running on: Windows 10

Issue Description

Im currently using IIS Web App Manage task to update the IIS Website Physical path. When try to update it to a physical path with a network unc path with double backslashes, i.e:

  • \\AzureShare\Website\1.0.0

image

i get the following error.

image

However, if i use a rooted drive path (i.e. C:\Website\1.1.0) it works fine.

Task logs

tasklog_4.log

Error logs

2020-05-20T01:21:16.2086575Z ##[error]The parameter is incorrect.

Release bug

Most helpful comment

@ChrisFulstow, i have added the credentials into cmdkey and its working now, Thank you for your help, much appreciated. 馃檪

All 16 comments

@gaz91au Can you please set system.debug as true in pipeline variables, redeploy and share the logs?

@eaarora-ms i get these logs

2020-05-20T06:23:09.0314073Z ##[debug]Evaluating condition for step: 'Update Master Website Physical Path'
2020-05-20T06:23:09.0356080Z ##[debug]Evaluating: succeeded()
2020-05-20T06:23:09.0361208Z ##[debug]Evaluating succeeded:
2020-05-20T06:23:09.0396094Z ##[debug]=> True
2020-05-20T06:23:09.0403465Z ##[debug]Result: True
2020-05-20T06:23:09.0441400Z ##[section]Starting: Update Master Website Physical Path
2020-05-20T06:23:09.1144645Z ==============================================================================
2020-05-20T06:23:09.1145265Z Task         : IIS web app manage
2020-05-20T06:23:09.1145720Z Description  : Create or update websites, web apps, virtual directories, or application pools
2020-05-20T06:23:09.1146028Z Version      : 0.5.14
2020-05-20T06:23:09.1146449Z Author       : Microsoft Corporation
2020-05-20T06:23:09.1146964Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/iis-web-app-management-on-machine-group
2020-05-20T06:23:09.1147750Z ==============================================================================
2020-05-20T06:23:10.2888581Z ##[debug]VstsTaskSdk 0.8.2 commit 
2020-05-20T06:23:10.5233061Z ##[debug]Entering C:\AzurePiplinesAgent_Extension\_work\_tasks\IISWebAppManagementOnMachineGroup_1b2aec60-dc49-11e6-9b76-63056e018cac\0.5.14\IISWebAppManagementOnMachineGroup.ps1.
2020-05-20T06:23:10.5312165Z ##[debug]Loading resource strings from: C:\AzurePiplinesAgent_Extension\_work\_tasks\IISWebAppManagementOnMachineGroup_1b2aec60-dc49-11e6-9b76-63056e018cac\0.5.14\Task.json
2020-05-20T06:23:10.5558478Z ##[debug]Loaded 8 strings.
2020-05-20T06:23:10.5680428Z ##[debug]SYSTEM_CULTURE: 'en-US'
2020-05-20T06:23:10.5691128Z ##[debug]Loading resource strings from: C:\AzurePiplinesAgent_Extension\_work\_tasks\IISWebAppManagementOnMachineGroup_1b2aec60-dc49-11e6-9b76-63056e018cac\0.5.14\Strings\resources.resjson\en-US\resources.resjson
2020-05-20T06:23:10.5977060Z ##[debug]Loaded 8 strings.
2020-05-20T06:23:10.6159607Z ##[debug]Loading module from path 'C:\AzurePiplinesAgent_Extension\_work\_tasks\IISWebAppManagementOnMachineGroup_1b2aec60-dc49-11e6-9b76-63056e018cac\0.5.14\ps_modules\TaskModuleIISManageUtility\TaskModuleIISManageUtility.psd1'.
2020-05-20T06:23:10.6396765Z ##[debug]Loading module from path 'C:\AzurePiplinesAgent_Extension\_work\_tasks\IISWebAppManagementOnMachineGroup_1b2aec60-dc49-11e6-9b76-63056e018cac\0.5.14\ps_modules\TaskModuleIISManageUtility\TaskModuleIISManageUtility.psm1'.
2020-05-20T06:23:10.6668680Z ##[debug]NonInteractive: False
2020-05-20T06:23:10.6960480Z ##[debug]Entering script AppCmdOnTargetMachines.ps1
2020-05-20T06:23:10.7001410Z ##[debug]Exporting function 'Invoke-Main'.
2020-05-20T06:23:10.7031090Z ##[debug]Adding exceptions types.
2020-05-20T06:23:10.8448324Z ##[debug]Importing function 'Invoke-Main'.
2020-05-20T06:23:10.8683161Z ##[debug]INPUT_ENABLEIIS: 'false'
2020-05-20T06:23:10.8710418Z ##[debug]INPUT_ACTIONIISWEBSITE: 'CreateOrUpdateWebsite'
2020-05-20T06:23:10.8769603Z ##[debug]INPUT_WEBSITENAME: 'alpha.thedocyard.co'
2020-05-20T06:23:10.8773240Z ##[debug]INPUT_STARTSTOPWEBSITENAME (empty)
2020-05-20T06:23:10.8827442Z ##[debug]INPUT_WEBSITEPHYSICALPATH: '\\AzureFileShare\Website\1.1.0'
2020-05-20T06:23:10.8848604Z ##[debug]INPUT_WEBSITEPHYSICALPATHAUTH: 'WebsiteWindowsAuth'
2020-05-20T06:23:10.8869128Z ##[debug]INPUT_WEBSITEAUTHUSERNAME: 'username'
2020-05-20T06:23:10.8889826Z ##[debug]INPUT_WEBSITEAUTHUSERPASSWORD: 'password'
2020-05-20T06:23:10.8910141Z ##[debug]INPUT_ADDBINDING: 'false'
2020-05-20T06:23:10.8930602Z ##[debug]INPUT_PROTOCOL: 'http'
2020-05-20T06:23:10.8952051Z ##[debug]INPUT_IPADDRESS: 'All Unassigned'
2020-05-20T06:23:10.8972475Z ##[debug]INPUT_PORT: '80'
2020-05-20T06:23:10.8993038Z ##[debug]INPUT_SERVERNAMEINDICATION: 'false'
2020-05-20T06:23:10.9018118Z ##[debug]INPUT_HOSTNAMEWITHOUTSNI (empty)
2020-05-20T06:23:10.9038025Z ##[debug]INPUT_HOSTNAMEWITHHTTP (empty)
2020-05-20T06:23:10.9058698Z ##[debug]INPUT_HOSTNAMEWITHSNI (empty)
2020-05-20T06:23:10.9079450Z ##[debug]INPUT_SSLCERTTHUMBPRINT (empty)
2020-05-20T06:23:10.9100436Z ##[debug]INPUT_BINDINGS (empty)
2020-05-20T06:23:11.1593585Z ##[debug]INPUT_CREATEORUPDATEAPPPOOLFORWEBSITE: 'false'
2020-05-20T06:23:11.1601039Z ##[debug]INPUT_APPPOOLNAMEFORWEBSITE (empty)
2020-05-20T06:23:11.1624348Z ##[debug]INPUT_DOTNETVERSIONFORWEBSITE: 'v4.0'
2020-05-20T06:23:11.1647156Z ##[debug]INPUT_PIPELINEMODEFORWEBSITE: 'Integrated'
2020-05-20T06:23:11.1664778Z ##[debug]INPUT_APPPOOLIDENTITYFORWEBSITE: 'ApplicationPoolIdentity'
2020-05-20T06:23:11.1681526Z ##[debug]INPUT_APPPOOLUSERNAMEFORWEBSITE (empty)
2020-05-20T06:23:11.1698308Z ##[debug]INPUT_APPPOOLPASSWORDFORWEBSITE (empty)
2020-05-20T06:23:11.1715383Z ##[debug]INPUT_CONFIGUREAUTHENTICATIONFORWEBSITE: 'false'
2020-05-20T06:23:11.1732651Z ##[debug]INPUT_ANONYMOUSAUTHENTICATIONFORWEBSITE: 'false'
2020-05-20T06:23:11.1750184Z ##[debug]INPUT_BASICAUTHENTICATIONFORWEBSITE: 'false'
2020-05-20T06:23:11.1768643Z ##[debug]INPUT_WINDOWSAUTHENTICATIONFORWEBSITE: 'false'
2020-05-20T06:23:11.1785844Z ##[debug]INPUT_PARENTWEBSITENAMEFORVD (empty)
2020-05-20T06:23:11.2577686Z ##[debug]INPUT_VIRTUALPATHFORVD (empty)
2020-05-20T06:23:11.2640667Z ##[debug]INPUT_PHYSICALPATHFORVD: '%SystemDrive%\inetpub\wwwroot'
2020-05-20T06:23:11.2968049Z ##[debug]INPUT_VDPHYSICALPATHAUTH: 'VDUserPassThrough'
2020-05-20T06:23:11.3211165Z ##[debug]INPUT_VDAUTHUSERNAME (empty)
2020-05-20T06:23:11.3216195Z ##[debug]INPUT_VDAUTHUSERPASSWORD (empty)
2020-05-20T06:23:11.3241963Z ##[debug]INPUT_PARENTWEBSITENAMEFORAPPLICATION (empty)
2020-05-20T06:23:11.3265206Z ##[debug]INPUT_VIRTUALPATHFORAPPLICATION (empty)
2020-05-20T06:23:11.3289693Z ##[debug]INPUT_PHYSICALPATHFORAPPLICATION: '%SystemDrive%\inetpub\wwwroot'
2020-05-20T06:23:11.3318204Z ##[debug]INPUT_APPLICATIONPHYSICALPATHAUTH: 'ApplicationUserPassThrough'
2020-05-20T06:23:11.3347430Z ##[debug]INPUT_APPLICATIONAUTHUSERNAME (empty)
2020-05-20T06:23:11.3368691Z ##[debug]INPUT_APPLICATIONAUTHUSERPASSWORD (empty)
2020-05-20T06:23:11.3391801Z ##[debug]INPUT_CREATEORUPDATEAPPPOOLFORAPPLICATION: 'false'
2020-05-20T06:23:11.3411066Z ##[debug]INPUT_APPPOOLNAMEFORAPPLICATION (empty)
2020-05-20T06:23:11.3428677Z ##[debug]INPUT_DOTNETVERSIONFORAPPLICATION: 'v4.0'
2020-05-20T06:23:11.3445447Z ##[debug]INPUT_PIPELINEMODEFORAPPLICATION: 'Integrated'
2020-05-20T06:23:11.3462152Z ##[debug]INPUT_APPPOOLIDENTITYFORAPPLICATION: 'ApplicationPoolIdentity'
2020-05-20T06:23:11.3479697Z ##[debug]INPUT_APPPOOLUSERNAMEFORAPPLICATION (empty)
2020-05-20T06:23:11.3496574Z ##[debug]INPUT_APPPOOLPASSWORDFORAPPLICATION (empty)
2020-05-20T06:23:11.3513335Z ##[debug]INPUT_ACTIONIISAPPLICATIONPOOL: 'CreateOrUpdateAppPool'
2020-05-20T06:23:11.3529607Z ##[debug]INPUT_APPPOOLNAME (empty)
2020-05-20T06:23:11.3545987Z ##[debug]INPUT_STARTSTOPRECYCLEAPPPOOLNAME (empty)
2020-05-20T06:23:11.3563065Z ##[debug]INPUT_DOTNETVERSION: 'v4.0'
2020-05-20T06:23:11.3579652Z ##[debug]INPUT_PIPELINEMODE: 'Integrated'
2020-05-20T06:23:11.3596191Z ##[debug]INPUT_APPPOOLIDENTITY: 'ApplicationPoolIdentity'
2020-05-20T06:23:11.3612358Z ##[debug]INPUT_APPPOOLUSERNAME (empty)
2020-05-20T06:23:11.3996224Z ##[debug]INPUT_APPPOOLPASSWORD (empty)
2020-05-20T06:23:11.4022537Z ##[debug]INPUT_APPCMDCOMMANDS (empty)
2020-05-20T06:23:11.4047173Z ##[debug]INPUT_IISDEPLOYMENTTYPE: 'IISWebsite'
2020-05-20T06:23:11.4360452Z ##[debug]Triming inputs for excess spaces, double quotes
2020-05-20T06:23:11.4630789Z ##[debug]Initiating action 'create or update' website
2020-05-20T06:23:11.4687232Z ##[debug]Entering Invoke-Main function
2020-05-20T06:23:11.4700571Z ##[debug]ActionIISWebsite = CreateOrUpdateWebsite
2020-05-20T06:23:11.4713469Z ##[debug]ActionIISApplicationPool = 
2020-05-20T06:23:11.4728623Z ##[debug]CreateApplication = 
2020-05-20T06:23:11.4742629Z ##[debug]CreateVirtualDirectory = 
2020-05-20T06:23:11.4755329Z ##[debug]VirtualPath = 
2020-05-20T06:23:11.4768037Z ##[debug]WebsiteName = alpha.thedocyard.co
2020-05-20T06:23:11.4781304Z ##[debug]PhysicalPath = \\AzureFileShare\Website\1.1.0
2020-05-20T06:23:11.4794022Z ##[debug]PhysicalPathAuth = WebsiteWindowsAuth
2020-05-20T06:23:11.4806658Z ##[debug]AddBinding = false
2020-05-20T06:23:11.4819460Z ##[debug]AppPoolName = 
2020-05-20T06:23:11.4832032Z ##[debug]DotNetVersion = 
2020-05-20T06:23:11.4844685Z ##[debug]PipeLineMode = 
2020-05-20T06:23:11.4857281Z ##[debug]AppPoolIdentity = 
2020-05-20T06:23:11.4869948Z ##[debug]ConfigureAuthentication = false
2020-05-20T06:23:11.4886735Z ##[debug]AnonymousAuthentication = false
2020-05-20T06:23:11.5613044Z ##[debug]BasicAuthentication = false
2020-05-20T06:23:11.6500117Z ##[debug]WindowsAuthentication = false
2020-05-20T06:23:11.6523311Z ##[debug]AppCmdCommands = 
2020-05-20T06:23:11.6850230Z ##[debug]Checking website exists. Running command : "C:\windows\system32\inetsrv\appcmd.exe"  list site /name:"alpha.thedocyard.co"
2020-05-20T06:23:11.6963546Z ##[debug]Entering Invoke-VstsTool.
2020-05-20T06:23:11.7051885Z ##[debug] FileName: 'C:\windows\system32\inetsrv\appcmd.exe'
2020-05-20T06:23:11.7066861Z ##[debug] Arguments: ' list site /name:"alpha.thedocyard.co"'
2020-05-20T06:23:11.7097589Z ##[command]"C:\windows\system32\inetsrv\appcmd.exe"  list site /name:"alpha.thedocyard.co"
2020-05-20T06:23:11.8764621Z ##[debug]Exit code: 0
2020-05-20T06:23:11.8792162Z ##[debug]Leaving Invoke-VstsTool.
2020-05-20T06:23:11.8833682Z ##[debug]Website ("alpha.thedocyard.co") already exists
2020-05-20T06:23:11.8908244Z ##[debug]Checking website physical path exists \\AzureFileShare\Website\1.1.0
2020-05-20T06:23:11.9038653Z ##[debug]Creating website physical path \\AzureFileShare\Website\1.1.0
2020-05-20T06:23:12.0499841Z ##[debug]Leaving C:\AzurePiplinesAgent_Extension\_work\_tasks\IISWebAppManagementOnMachineGroup_1b2aec60-dc49-11e6-9b76-63056e018cac\0.5.14\IISWebAppManagementOnMachineGroup.ps1.
2020-05-20T06:23:12.1123809Z ##[debug]Caught exception from task script.
2020-05-20T06:23:12.1168196Z ##[debug]Error record:
2020-05-20T06:23:12.2382948Z ##[debug]C:\AzurePiplinesAgent_Extension\_work\_tasks\IISWebAppManagementOnMachineGroup_1b2aec60-dc49-11e6-9b76-63056e018cac\0.5.14\IISWebAppManagementOnMachineGroup.ps1 : The parameter is incorrect.
2020-05-20T06:23:12.2400857Z ##[debug]
2020-05-20T06:23:12.2415534Z ##[debug]At line:1 char:1
2020-05-20T06:23:12.2430391Z ##[debug]+ . 'C:\AzurePiplinesAgent_Extension\_work\_tasks\IISWebAppManagementOn ...
2020-05-20T06:23:12.2444598Z ##[debug]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2020-05-20T06:23:12.2458594Z ##[debug]    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
2020-05-20T06:23:12.2473479Z ##[debug]    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,IISWebAppManagementOnMachineGroup.ps1
2020-05-20T06:23:12.2497677Z ##[debug] 
2020-05-20T06:23:12.2543710Z ##[debug]Script stack trace:
2020-05-20T06:23:12.2569248Z ##[debug]at <ScriptBlock>, C:\AzurePiplinesAgent_Extension\_work\_tasks\IISWebAppManagementOnMachineGroup_1b2aec60-dc49-11e6-9b76-63056e018cac\0.5.14\IISWebAppManagementOnMachineGroup.ps1: line 128
2020-05-20T06:23:12.2588298Z ##[debug]at <ScriptBlock>, <No file>: line 1
2020-05-20T06:23:12.2602671Z ##[debug]at <ScriptBlock>, <No file>: line 22
2020-05-20T06:23:12.2617690Z ##[debug]at <ScriptBlock>, <No file>: line 18
2020-05-20T06:23:12.2622184Z ##[debug]at <ScriptBlock>, <No file>: line 1
2020-05-20T06:23:12.2637169Z ##[debug]Exception:
2020-05-20T06:23:12.2712179Z ##[debug]Microsoft.PowerShell.Commands.WriteErrorException: The parameter is incorrect.
2020-05-20T06:23:12.2718770Z ##[debug]
2020-05-20T06:23:12.3078789Z ##[error]The parameter is incorrect.

2020-05-20T06:23:12.3090108Z ##[debug]Processed: ##vso[task.logissue type=error]The parameter is incorrect.%0D%0A
2020-05-20T06:23:12.3101319Z ##[debug]Processed: ##vso[task.complete result=Failed]
2020-05-20T06:23:12.3486369Z ##[section]Finishing: Update Master Website Physical Path

sorry @eaarora-ms , i just edited my above post to show logs which contain The parameter is incorrect. error.

@eaarora-ms if it helps, this is my task yaml

steps:
- task: IISWebAppManagementOnMachineGroup@0
  displayName: 'Update Website Physical Path'
  inputs:
    WebsiteName: alpha.thedocyard.co
    WebsitePhysicalPath: '\\$(AzureShare)\$(WebsiteName)\$(Build.BuildNumber)'
    WebsitePhysicalPathAuth: WebsiteWindowsAuth
    WebsiteAuthUserName: '$(AzureShareUsername)'
    WebsiteAuthUserPassword: '$(AzureSharePassword)'
    WindowsAuthenticationForWebsite: false 

@gaz91au Mostly this error occurs when your IIS website is not assigned to a valid application pool. Can you please verify that the default app pool exists and let us know?
Also, can you try using the Create/Update App pool option from the task and let us know the results?

@eaarora-ms i can confirm that the IIS Website already is up and running and has a valid application pool assigned to it.

Im hesitant to use Create/Update App pool because ive already got a valid application pool and dont want to override any existing settings.

@gaz91au Can you please try restarting the IIS Website and let us know the result?

@eaarora-ms still getting the same error after restarting the IIS Website

@gaz91au does the path \\AzureFileShare\Website\1.1.0 already exist? Could it be trying to create the directory but not have permissions? Just looking at the log:
##[debug] Creating website physical path \\AzureFileShare\Website\1.1.0

@ChrisFulstow yes \\AzureFileShare\Website\1.1.0 exists.

@ChrisFulstow @eaarora-ms Its definitely a permissions issue, im using the VMSS TeamServicesAgent Extension which executes this pipeline on VMSS instances and when it checks if the path exists, it fails to find the path. Is it because its trying to check a path that is a authenticated Azure File Share path?

  • ##[debug]Checking website physical path exists \\AzureFileShare\Website\1.1.0

Heres my TeamServicesAgent Settings:

{
  "VSTSAccountUrl": "https://dev.azure.com/tdydev",
  "TeamProject": "tdyapp",
  "DeploymentGroup": "alpha-vmss-aue",
  "AgentName": "",
  "Tags": ""
}

@gaz91au I'm pretty sure this task does a Test-Path to first check whether the physical path exists before updating IIS. Which credentials is it using to connect to the file share? I think it should be:

WebsiteAuthUserName: AZURE\<storage-account-name>
WebsiteAuthUserPassword: <storage-account-access-key>

@ChrisFulstow It fails at Test-Path, Ive updated the task to use AZURE\<storage-account-name> but that didnt fix it.

One thing to note is that im using the VMSS Azure Agent Extension, and it installs the agent under NT AUTHROTY\SYSTEM user, which i think doesnt have permissions to do the Test-File.

When i remote into the VMSS Instance as an admin and manuially do a Test-File \\AzureShare\Website\1.1.0 it returns True. So i think this its definitely an permissions issue.

@eaarora-ms Is there any way i can install the VMSS Azure Agent Extension as an admin user?

@gaz91au can you save the Azure file share credentials using cmdkey?

@ChrisFulstow, i have added the credentials into cmdkey and its working now, Thank you for your help, much appreciated. 馃檪

@ChrisFulstow Thanks for the help!

Was this page helpful?
0 / 5 - 0 ratings