Include pipeline variables in release notifications - azure-devops

I am using Azure Devops (formerly VSTS) releases to deploy a project.
In my release pipeline I have a power shell task that may not succeed in ways that do not indicate a deployment failure. I would like to alert users when these conditions arise.
I have suppressed the errors in the power shell script and am using them to control flow to subsequent pipeline tasks.
Is there a way include pipeline variables in the notifications Azure Devops sends when a deployment is complete?

No, the notification template is not customizable and this feature was requested: Customise VSTS email templates
But you may log your pipeline variables with powershell script: Write-Host "My var: $(my_variable)"
User-defined variables

Related

Executing a power automate flow from YAML

Quick question - is there a way to use YAML (in an azure pipeline) to trigger an power automate (or a logic app) with parameters ?
I can see the other way around - so from power automate to trigger an pipeline but not the way i need.
Thanks
We trigger Power Automate Flows by using the Azure DevOps Invoke REST API task. This needs to have a Service Connection of Generic type which is only used to specify the Server URL.
To use this, your Pipeline needs to use an Agentless Job which you choose by clicking the ellipsis in the Pipeline and adding an agentless job.

Azure Devops Service Now - how to get CHANGE_REQUEST_NUMBER/CHANGE_CORRELATION_ID for YAML pipeline

Following the MS documentation here: https://learn.microsoft.com/en-us/azure/devops/pipelines/release/approvals/servicenow?view=azure-devops
I've set up an Azure DevOps environment with the Service Now Pre-deployment check and can successfully create a new standard change request in Service Now and update it using the UpdateServiceNowChangeRequest#2 task.
However, I'm struggling to find a way to access the CHANGE_REQUEST_NUMBER and CHANGE_CORRELATION_ID that are available to the UpdateServiceNowChangeRequest#2 tasks
The documentation describes how to get to these using the release pipeline by having a name for the gate and using $(PREDEPLOYGATE.mygatename.CHANGE_REQUEST_NUMBER), but there is no option in the YAML setup to name a gate and I can't seem to find another way to get to these variables
I've tried just enumerating all the environment variables in the pwsh task (i.e. gci env:\ ) but nothing relating to these variables shows up.

In Azure DevOps YML pipeline, how to mandate template call?

I have a template to perform some post build(end of the pipeline) checks. This check must happen in a build, after few jobs successfully finished.
I want to ensure, template call must be the last job in main pipeline and no control to author to skip. How to mandate template usage ?
Because this template based checks not applicable to all pipelines with in Azure DevOps organization.
Is it possible to use template as a decorator backend and conditionally inject it into selected pipelines in a organization ?
Does decorator support parametrization ?

How to invoke Powershell script from post-deployment approvals/Post-deployment gates in Azure DevOps

I have Build pipeline and release pipeline in Azure DevOps which works fine. I want to start the website using power shell script which is in repo ,only after post-deployment approvals in release pipeline. Do some initial Manual checks and start the website
Release Pipeline
Task 1: stop website
Task 2: deploy website
Do initial Manual checks before starting the website
Task 3: Start website using post-deployment approvals
I am afraid it is impossible to invoke powershell scripts from post-deployment approvals.
However, if your website is deployed to azure resources. You can run the powershell scripts by Invoking Azure Function from post-deployment gates. You will need to create a Azure function to start the website using powershell script. See document Create a PowerShell function in Azure using Visual Studio Code.
There is another workaround using Manual intervention task instead of post-deployment approvals.
You can add an agentless job to run Manual intervention task(Notify the users to approve) after website is deployed.
And then run the power shell script to start up your website in the next job see below:

Azure DevOps- Hide Release Task Logs

Looking for suggestions on a problem I'm facing in pipeline deployments for Azure Functions. I'm using the new Azure App Config service to pull app configuration variables to the pipeline.
These are then being used by an Azure App Service Deploy Task in the App settings section to populate the app configuration of an Azure Function. I'm in need of a way to hide the release logs for this from our developer group in the production stage of our deployment. Otherwise it will display the the app settings in the log file from the release. We still want devs to be able to see other stages of the release pipeline.
I believe I could write a powershell script to mark the variables as secrets, but that seems less manageable based on the number of release pipelines and variables that would need to be scripted. I would rather just be able to hide the logs from everyone besides a select group of users or turn them off for that release task in general by stage.
I'm also trying to avoid using Key-Vault for this scenario.
So long story short-
Is there a way to turn off logs for a specific release task in AzDo? If possible by stage?
Is there a way to hide logs by stage? Can that be done on a user level?
Suggestions are appreciated.
No, this is not possible and leads to security by obscurity.
Just use keyvault or use a script to register the secret values. You don't have to hard-code them in a powershell step or anything, you can register secrets by parsing whatever settings file you have and calling:
write-host "##vso[task.setvariable variable=$name;issecret=true]$valueToRegister"
See:
https://github.com/Microsoft/azure-pipelines-tasks/blob/master/docs/authoring/commands.md