Hello,
We are trying to create Web App Targets dynamically in Octopus Deploy using New-OctopusAzureWebAppTarget
powershell command.
Following is the sample script we are trying to run.
New-OctopusAzureWebAppTarget -name “dev-test-cd” -azureWebApp 'test-cd'
-azureResourceGroupName ‘myresourcegroup’ -octopusAccountIdOrName 'my azure subscription name with spaces'
-octopusRoles ‘CD’ `
-updateIfExisting
We are running this script via an Azure Powershell step and the step runs on octopus deploy server.
The script fails with the following message.
Account with Id / Name, my azure subscription name with spaces, not found.
Error running AzureWebAppCreateTargetServiceMessageHandler for create-azurewebapptarget: Account with Id / Name, my azure subscription name with spaces, not found.
System.Exception: Account with Id / Name, my azure subscription name with spaces, not found.
at Octopus.Server.Orchestration.ServerTasks.Deploy.ActionDispatch.ServiceMessageHandlers.AzureWebAppCreateTargetServiceMessageHandler.BuildAzureWebAppEndpoint(ScriptOutputAction action, VariableDictionary variables)
at Octopus.Server.Orchestration.Targets.Scripting.ServiceMessageHandlerCreateTargetBase.CreateOrUpdateTarget(ScriptOutputAction action, VariableDictionary variableDictionary)
at Octopus.Server.Orchestration.ServerTasks.Deploy.ActionDispatch.ServiceMessageHandlers.AzureWebAppCreateTargetServiceMessageHandler.HandleServiceMessage(ScriptOutputAction action, VariableCollection variables, ITaskContext taskContext, ActionCommand command)
at Octopus.Server.Orchestration.ServerTasks.Deploy.ActionDispatch.ServiceMessageHandlers.ServiceMessageProcessor.ExecuteHandlersForAction(ILog log, VariableCollection variables, ScriptOutputAction action, ActionCommand command)
Octopus.Server version 2018.11.3 (2018.11.3+Branch.tags-2018.11.3.Sha.b3219050e8151203eeb7e6976f1615c9b2d375c1)
Please note I have replace the real subscription name with ‘my azure subscription name with spaces’
We have also tried passing subscription id to the command instead, but got the similar error result.
On a related note, we have managed to execute the above script successfully on a different Azure subscription (with corresponding subscription related command arguments of course). So it appears the issue is related to current subscription. However we could not find the root of the issue.
Do you know under which condition(s) Octopus Azure Powershell step returns above error? Which might point us in the right direction to diagnose the issue.
Thanks,
Mahesh