Skip to content
| Marketplace
Sign in
Azure DevOps>Azure Pipelines>Graph Connector
Graph Connector

Graph Connector

Moim Hossain

|
19 installs
| (0) | Free
This extension provides a connector to the Microsoft Graph API.
Get it free

Graph Connector

This extension allows users to connect to Microsoft Graph and post messages to Microsoft Teams. The connector uses OAuth 2.0 to authenticate and authorize users to access Microsoft Graph.

Disclaimer: This extension is not an official extension from Microsoft. It is an open-source project developed by the author. The author is not responsible for any issues or damages caused by the use of this extension.

Quick Look

Author

  • Moim Hossain

Prerequisites

In order to use this extension, you need to have a Microsoft Azure account and a Microsoft Teams account. You also need to have the following:

  • A registered Azure AD application, with following configurations:
    • Reply URL: https://dev.azure.com/<Organization>/_admin/oauth2/callback.
    • Access tokens (used for implicit flows) and ID tokens (used for OpenID Connect flows) enabled.
    • Required permissions: ChannelMessage.Send, offline_access, openid, profile, User.Read.
    • Consent granted for the application.
    • Generate a client secret for the application.

Azure AD Application

Azure AD Application

Configure OAuth connection in Azure DevOps

  1. Go to Azure DevOps Organization settings > OAuth Configurations.
  2. Create a new OAuth configuration with following details:
    • Name: A name for the OAuth configuration.
    • Source Type: Entra Authentication.
    • Authorization URL: https://login.microsoftonline.com/<Entra Tenant GUID>. Replace <Entra Tenant GUID> with the GUID of the Azure AD tenant. Don't add /oauth2/authorize at the end.
    • Client ID: The Application ID of the registered Azure AD application.
    • Client Secret: The client secret generated for the application.

OAuth Configuration

Create Service Connection

  1. Go to Azure DevOps Project settings > Service connections.
  2. Create a new service connection with following details:
    • Service connection type: Entra Authentication.
    • Service connection name: A name for the service connection.
    • OAuth configuration: The OAuth configuration created in the previous step.
    • Press Authorize to authorize the service connection. It will open a new window to authenticate and authorize the application. You can sign in with your Microsoft Teams account.

Service Connection

Usage

You can use the connector to post messages to Microsoft Teams from an Azure Pipeline. Here is an example of how to use the connector in a pipeline:

trigger:
- main

pool:
  vmImage: ubuntu-latest

steps: 
- task: SendMessageToTeamsChannel@1.0.0
  inputs:
    EntraConnection: '<Service Connection Name>'
    teamId: '00000000-0000-0000-0000-000000000000'
    channelId: 'xxx.tacv2'
    payloadType: plaintext
    messageText: | 
      Hello world,
      A quick brown fox
      jumped over the lazy dog

Run the pipeline and you will see the message posted to the specified channel in Microsoft Teams.

Teams

If you want to send a rich message, you can use the payloadType: json and provide a JSON payload in the messageText input.

You can create a payload JSON file either in repository or create in a previous step and use it in the task.

For example, if we have a payload json file card-message.json in the repository:

{
    "subject": null,
    "body": {
        "contentType": "html",
        "content": "<attachment id=\"74d20c7f34aa4a7fb74e2b30004247c5\"></attachment>"
    },
    "attachments": [
        {
            "id": "74d20c7f34aa4a7fb74e2b30004247c5",
            "contentType": "application/vnd.microsoft.card.thumbnail",
            "contentUrl": null,
            "content": "{\r\n  \"title\": \"This is an example of posting a card\",\r\n  \"subtitle\": \"<h3>This is the subtitle</h3>\",\r\n  \"text\": \"Here is some body text. <br>\\r\\nAnd a <a href=\\\"http://microsoft.com/\\\">hyperlink</a>. <br>\\r\\nAnd below that is some buttons:\",\r\n  \"buttons\": [\r\n    {\r\n      \"type\": \"messageBack\",\r\n      \"title\": \"Login to FakeBot\",\r\n      \"text\": \"login\",\r\n      \"displayText\": \"login\",\r\n      \"value\": \"login\"\r\n    }\r\n  ]\r\n}",
            "name": null,
            "thumbnailUrl": null
        }
    ]
}

Then you can use the following pipeline:

trigger:
- main

pool:
  vmImage: ubuntu-latest

steps: 
- task: SendMessageToTeamsChannel@1.0.0
  inputs:
    EntraConnection: '<Service Connection Name>'
    teamId: '00000000-0000-0000-0000-000000000000'
    channelId: 'xxx.tacv2'
    payloadType: json
    payloadFilePath: './card-message.json' # Path to the JSON payload file

This will post a rich message to the specified channel in Microsoft Teams.

Teams

Contact

If you have any questions or need help, feel free to contact the author at https://moimhossain.com.

License

This project is licensed under the MIT License - see the LICENSE file for details.


  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft