Azure DevOps with Slack Approvals
In this blog Azure DevOps with Slack Approvals you will learn about the various integration options that can be used to bring Slack and Azure DevOps closer.
Slack is deprecating the Visual Studio Teams Services (VSTS) app from its app store. This app was built by the Slack team a few years ago and provides basic integration between VSTS and Slack. The app allowed users to get notified of the events in Azure DevOps such as the creation of pull requests, updates to work items, completed builds, and more.
In addition to receiving notifications on events from Azure DevOps, these new apps support rich features such has:
- Creating work items using a command or messaging action
- Approving / rejecting releases from the Slack channel
- Notifying teammates with @mention support for action
- Unfurling URLs for work items, pull requests and pipelines
- Supporting notifications for new YAML based pipelines
Azure Pipelines with Slack
We can set up and manage subscriptions for builds, releases, YAML pipelines, pending approvals, and more from the app and get notifications for these events in your Slack channels.
This feature is only available on Azure DevOps Services. Typically, new features are introduced in the cloud service first, and then made available on-premises in the next major version or update of Azure DevOps Server.
Add the Azure Pipelines app to your Slack workspace
Navigate to Azure Pipelines Slack app to install the Azure Pipelines app to your Slack workspace. Once added, you will see a welcome message from the app as shown below.
/azpipelines handle to start interacting with the app.
Once the app has been installed in your Slack workspace, you can connect the app to the pipelines you want to monitor. The app will ask you to authenticate to Azure Pipelines before running any commands.
To start monitoring all pipelines in a project, use the following slash command inside a channel:
/azpipelines subscribe [project url]
/azpipelines subscribe https://dev.azure.com/myorg/myproject/
To manage the subscriptions for a channel, use the following command:
This command will list all the current subscriptions for the channel and allow you to add new subscriptions.
Approve deployments from your channel :
You can approve deployments from within your channel without navigating to the Azure Pipelines portal by subscribing to the Release deployment approval pending notification for classic Releases or the Run stage waiting for approval notification for YAML pipelines. Both of these subscriptions are created by default when you subscribe to the pipeline.
Whenever the running of a stage is pending for approval, a notification card with options to approve or reject the request is posted in the channel. Approvers can review the details of the request in the notification and take appropriate action. In the following example, the deployment was approved and the approval status is displayed on the card.
The app supports all the checks and approval scenarios present in Azure Pipelines portal, like single approver, multiple approvers (any one user, any order, in sequence) and teams as approvers. You can approve requests as an individual or on behalf of a team.
Azure Boards with Slack
The Azure Boards app for Slack allows users to set up and manage subscriptions to create, update, and work with other item events, and get notifications for these events in their Slack channel.
Conversations in the Slack channel can be used to create work items. Previews for work item URLs help users to initiate discussions around work.
- To create a work item, we must be a contributor to the Azure Boards project.
- To create subscriptions in a Slack channel for work item events, we must be a member of the Azure Boards Project Administrators group or Team Administrators group.
- To receive notifications, the Third party application access via OAuth setting must be enabled for the organization.
- Once after the above is done, we can see the welcome app message from the Slack channel.
Once the app has been installed in your Slack workspace, connect and authenticate yourself to Azure Boards.
After signing in, use the following slash command inside a Slack channel to link to the Azure Boards project which you specify with the URL :
/azboards link [project url]
for example :
/azboards link https://dev.azure.com/myorg/myproject
Create a work item with a command
- With Azure Boards app you can create work items from your channel. The app supports custom work items as well.
To create a work item, use
You can create work items directly from a command by passing work item type and title as parameters. Work items will be created only if they do not have any fields to be mandatorily filled.
/azboards create [work item type] [work item title]
/azboards create ‘user story’ Push cloud monitoring alerts to mobile devices
we can create a work item based on the message shown below :
This will be the preview of the work item created from the slack channel.
Azure Repos with Slack
We can set up and manage subscriptions to receive notifications in your channel whenever code is pushed/checked in and whenever a pull request (PR) is created, updated or a merge is attempted.
This app supports both Git and Team Foundation Version Control (TFVC) events.
- To create subscriptions in a Slack channel for repository-related events, we must be a member of the Azure Project Administrators group or Team Administrators group.
- To receive notifications, the Third-party application access via OAuth setting must be enabled for the organization.
Once the app has been installed in your Slack workspace, connect and authenticate yourself to Azure Repos using
/azrepos signin command.
To start monitoring all Git repositories in a project, use the following slash command inside a channel ,
/azrepos subscribe [project url]
/azrepos subscribe https://dev.azure.com/myorg/myproject/
/azrepos subscribe https://dev.azure.com/myorg/myproject/_git/myrepository
For TFVC :
/azrepos subscribe https://dev.azure.com/myorg/myproject/_versionControl
The subscribe command gets you started with a default subscription. For Git repositories, the channel is subscribed to the Pull request created event (with target branch = master), and for TFVC repositories, the channel is subscribed to the Code checked in event.
To view, add and remove subscriptions for a channel, use the
Example: Get notifications only when my team is in the reviewer list for a PR
Example: Tell me when merge attempts fail due to a policy violation
When a user pastes the URL of a PR, a preview is shown like the one in the following image. This helps to keep PR-related conversations contextual and accurate.
These are the 3 main SLACK APP which is mainly used for Azure DevOps.We can have this integrated and do the day 2-day work being in the slack itself.