Deploy Azure Web App failed with Custom Deployment Scripts

Deploy Azure Web App step failed with feature Custom Deployment Scripts

The deploy step used to work with Octopus v2018.7.13
Fails since upgrade to Octopus v2018.8.1

Error KeyError: ‘cloud’

File “C:\Users\troyd\AppData\Local\Temp\pip-install-8mvi0rnf\azure-cli-core\azure\cli\core\”, line 234, in get_active_cloud_name

configparser.NoSectionError: No section: ‘cloud’

File “C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\knack\”, line 78, in set with open(self.config_path, ‘w’) as configfile:
PermissionError: [Errno 13] Permission denied: ‘D:\Octopus\Work\20180911145023-59778-113\staging\config’

How to recreate:
Add process step: Deploy an Azure Web App
Execute on Worker in Default Worker Pool on behalf of target role: azure -web-app Role
Select a web app Package

Configure features: Custom Deployment Scripts

Create release and deploy to Azure Web Target


Can I just verify that I understand your setup correctly? From what I can see it looks like you’ve got the Azure CLI installed locally on the deployment server and have configured Octopus to use that version?

From the error it looks like that script is trying to open that config file with write permissions, and the user the server/worker is running as doesn’t have write access to that file.


Yes we installed Azure CLI on the Worker.
The Octopus Tentacle on the Worker is running under Local System account (admin permission).
I set the variable OctopusUseBundledAzureCLI but it didn’t make any difference.


Sorry I forgot to ask an obvious question earlier, does your script actually need the CLI? If you’re not using it then you could use the OctopusDisableAzureCLI variable to disable the CLI setup that is causing the issue.