ms.service | ms.subservice | ms.topic | ms.custom | title | description | ms.manager | ms.author | author | ms.date | monikerRange |
---|---|---|---|---|---|---|---|---|---|---|
azure-devops |
azure-devops-integration |
how-to |
freshness-fy22q2, cross-service |
Integrate Microsoft Teams |
Connect Azure Pipelines to Microsoft Teams, monitor your pipelines in your channel, and subscribe to notifications. |
mijacobs |
jukullam |
juliakm |
07/12/2024 |
azure-devops |
Note
Microsoft Teams integration support for service hooks is retiring as of December 31, 2024 for new integrations and January 31, 2025 for existing integrations. We recommend using Power Automate workflows to provide maximum security for your data. For more information, see Retirement of Office 365 connectors within Microsoft Teams.
[!INCLUDE version-eq-azure-devops]
[!INCLUDE temp]
This article shows you how to use the Azure Pipelines app for Microsoft Teams to monitor pipeline events. You can set up and get notifications in your Teams channel for pipeline builds, releases, and approvals. Approvers can also approve releases from within the Teams channel.
Note
Azure Pipelines notifications aren't supported inside Teams chat or direct messages.
- Access to a Team in Microsoft Teams where you can add an app.
- Project Administrator or Build Administrator permissions in an Azure DevOps project. For more information, see Create a project and Pipeline security resources.
- Third party application access via OAuth enabled in Azure DevOps organizational settings.
-
In Microsoft Teams, select Apps, search for Azure Pipelines, and then select Azure Pipelines.
:::image type="content" source="media/integrations-teams/select-azure-pipelines.png" alt-text="Screenshot of selecting the Apps button, then Azure Pipelines button.":::
-
Select the dropdown arrow next to Add, and select Add to a team.
:::image type="content" source="media/integrations-teams/open-and-add-to-a-team.png" alt-text="Screenshot of selecting Open button and then Add to a team button.":::
-
Select or enter your team name, and then select Set up a bot.
:::image type="content" source="media/integrations-teams/set-up-a-bot.png" alt-text="Screenshot of selecting the Set up a bot button.":::
The Azure Pipelines Teams app supports the following commands:
Slash command | Functionality |
---|---|
@azure pipelines signin | Sign in to your Azure Pipelines account. |
@azure pipelines signout | Sign out from your Azure Pipelines account. |
@azure pipelines subscribe <pipeline url | project url> | Subscribe to a pipeline or all pipelines in a project to receive notifications. |
@azure pipelines subscriptions | View, add, or remove subscriptions for this channel. |
@azure pipelines unsubscribe all <project url> | Remove all pipelines belonging to a project and their associated subscriptions from a channel. |
@azure pipelines help | Get help on the commands. |
@azure pipelines feedback | Report a problem or suggest a feature. |
- In the Teams conversation pane, enter
@azurePipelines signin
. - Select Sign in and complete authentication to Azure Pipelines.
Use the following commands to subscribe to and monitor all pipelines in a project or only specific pipelines.
-
All pipelines in a project: The URL can be to your project or any page within your project, except to a pipeline. For example:
@azure pipelines subscribe https://dev.azure.com/myorg/myproject/
-
A specific pipeline: The pipeline URL can be to any page within a pipeline that has a
definitionId
orbuildId/releaseId
in the URL. For example:@azure pipelines subscribe https://dev.azure.com/myorg/myproject/_build?definitionId=123
All replies for a particular post are linked together.
:::image type="content" source="media/integrations-teams/threads-pipelines-compact-view.png" alt-text="Screenshot showing the compact thread view.":::
To expand the thread, select the compacted thread link.
:::image type="content" source="media/integrations-teams/threads-pipelines-expanded-view.png" alt-text="Screenshot showing the expanded thread view.":::
When you subscribe to a pipeline, a few subscriptions get created by default without any filters applied. These subscriptions include Run state changed and Run stage waiting for approval for YAML pipelines, and Release deployment approval pending for Classic releases. You can remove these subscriptions or add more subscriptions.
The Azure Pipelines app also supports filters to customize what you see in your channel. For example, you might want to get notified only when builds fail or when deployments get pushed to a production environment.
To manage your subscriptions, complete the following steps.
-
To list all pipelines subscriptions, run the
@azure pipelines subscriptions
command.:::image type="content" source="media/integrations-teams/subscriptions-list-teams.png" alt-text="Screenshot showing view of list of subscriptions.":::
-
To remove a subscription, select View all subscriptions. Select Remove under any subscription you don't want, and then select OK.
-
To add a subscription, select Add subscription.
-
Select the event and the pipeline you want to subscribe to, and select Next.
-
Choose any Stage and Environment filters you want, select Submit, and then select OK.
For example, the following subscription provides notifications for the _default stage only when the Completed state is Failed.
:::image type="content" source="media/integrations-teams/build-failure-notification.png" alt-text="Screenshot showing filters for notifications.":::
Note
Team Administrators can't remove or modify subscriptions that are created by Project Administrators.
To see approval notifications, make sure you subscribe to the Run stage waiting for approval notification for YAML pipelines or the Release deployment approval pending notification for Classic releases. These subscriptions are created by default when you subscribe to the pipeline.
If you subscribe to the Run stage approval completed notification, you can also see when the stage is approved.
:::image type="content" source="media/integrations-teams/approved-teams.png" alt-text="Card showing approved deployment.":::
Note
You can't subscribe to deployment approvals that have the Revalidate identity of approver before completing the approval policy applied.
If you're an approver, you can approve deployments from within your Teams channel. The Azure Pipelines app supports all Azure Pipelines checks and approval scenarios. You can approve requests as an individual or for a team.
Whenever the running of a stage is pending your approval, the app posts a notification card with options to Approve or Reject the request in the channel. You can review the details of the request in the notification and take appropriate action.
:::image type="content" source="media/integrations-teams/approve-teams.png" alt-text="Screenshot showing ready for approval notification.":::
The response is sent to the app.
:::image type="content" source="media/integrations-teams/approve-teams-pending.png" alt-text="Screenshot showing approval pending notification.":::
If you subscribed to Run stage approval completed notifications, you can also see when the stage is approved.
Run the unsubscribe
command to delete all the subscriptions related to any pipeline in the project and remove the pipelines from the channel. For example:
@azure pipelines unsubscribe all https://dev.azure.com/myorg/myproject
:::image type="content" source="media/integrations-teams/unsubscribe-project.png" alt-text="Screenshot showing unsubscribe pending message.":::
To delete the project and all subscriptions from the channel, select Proceed.
Important
Only Project Administrators can run this command.
To help you search and share information about pipelines, the Azure Pipelines app for Teams supports a compose extension in messages. You can use the extension to search for pipelines in a project by pipeline ID or pipeline name.
To use the extension, you must be signed in to the Azure Pipelines project in the Teams channel. Select the + symbol in the message field, select Azure Pipelines, and then search for your pipeline or release.
:::image type="content" source="media/integrations-teams/compose-extension.png" alt-text="Screenshot showing the compose extension.":::
When you use the compose extension to add a pipeline URL to a Teams message, you see a preview similar to the following images. The preview helps to keep pipeline-related conversations relevant and up to date.
:::image type="content" source="media/integrations-teams/build-url-unfurling-teams.png" alt-text="Screenshot showing Build URL unfurling.":::
The following example shows a Release URL preview:
:::image type="content" source="media/integrations-teams/release-url-unfurling-teams.png" alt-text="Screenshot showing Release URL unfurling.":::
If you use different emails or tenants for Microsoft Teams and Azure DevOps, follow these steps to sign in and connect based on your settings.
Microsoft Teams | Azure DevOps | Sign in action |
---|---|---|
email1@abc.com (tenant1) | email1@abc.com (tenant1) | Select Sign in |
email1@abc.com (tenant1) | email2@pqr.com (tenant2) | 1. Sign in to Azure DevOps. 2. In the same browser, start a new tab and go to https://teams.microsoft.com/. 3. Run the sign in command and select Sign in. |
email1@abc.com (tenant1) | email2@pqr.com (tenant2) | 1. Select Sign in with different email address. 2. In the email ID picker, use the email2 to sign in. |
email1@abc.com (tenant1) | email2@pqr.com (nondefault tenant3) | Not supported. |
In the same browser, start a new tab and sign in to https://teams.microsoft.com/
. Run the @Azure Pipelines signout
command and then run the @Azure Pipelines signin
command in the channel where the Azure Pipelines app for Microsoft Teams is installed.
Select the Sign in button, and complete the sign-in process. Ensure that the directory shown is the same as what you chose in the previous step.
If these steps don't resolve your authentication issue, reach out to the Developer Community.