Hi support.
We have projects that target both Azure environments and On-premises environments.
On-premises environments have been tagged one way (app-onprem for the examples in this post.)
Azure environments have been tagged another (app-azure for the examples in this post).
With the projects there is a step to deploy a Windows Service for the on-premises hosts.
The step’s ‘Runs on targets in roles’ setting has been set to point to ‘app-onprem’
There is a step to deploy WebJobs for the Azure hosts.
The step’s ‘On behalf of target roles’ setting has been set to point to 'app-azure’
The Azure Account in the step uses a custom binding to refer to a scoped variable called #{Azure.Account.OctoReference} to identify the account.
On deployment this works fine when deploying to an Azure environment.
But when deploying to an on-premises environment, unless you tick the box telling it to skip the webjob step, it’ll have an error at the top of the page saying:
The expression #{Azure.Account.OctoReference} could not be expanded to an Account ID.
Make sure you have created the variables in this expression and scoped them correctly for the SYD-BS-VVG01 environment.
Once you have corrected these problems you can try again.
If the problem is related to a variable you will need to update the variables for this release or recreate the release for the changes to take effect.
If the problem is related to the deployment process you will need to create a new release for the changes to take effect.
There is nothing in the on-premises environment that is tagged with the ‘app-azure’ tag.
I was hoping that would mean this step would get skipped, and I think it showed up as a warning about no targets matching, so it would be skipped at deploy time anyway if the deploy was allowed to proceed…
The only way I’ve found to avoid the problem is to tag add all of the Azure environments to ‘Environments’ within the Conditions section.
However, each ime a new Azure environment is added, it would mean having to find all WebJobs steps in all projects and editing them and adding the new environment to this list.
There must be a better way to handle this.
Can you please advise on how I could be doing this better?
Thanks.