Using the ‘HTTP with Azure AD’ connector in Power Automate to create Planner Plans and add them as Teams tabs

Some people have reported to me that the beloved Send an HTTP request (V1) under Office 365 groups that we used to easily call Microsoft Graph is not available anymore when creating new flows.

It turns out it has recently been deprecated, as stated by Microsoft, and we are recommended to use V2 instead:

Unfortunately, the V2 action under the Office 365 Groups connector only supports the /groups endpoint and will not allow us to create planner plans.

The alternative

At the moment there is no alternative available with Standard licenses to call the Teams and Planner endpoints. However, we can use the ‘HTTP with Azure AD’ (which I believe that soon is going to be renamed to something related to ‘Microsoft Entra’ due to product naming change) connector to call Microsoft Graph, and create plans/teams tabs, if you have access to proper Power Automate licensing.

As in a previous example I wrote, let’s build the Flow to create a Planner Plan and add it as tab to the General channel of a Teams team, but this time, using this connector.

Step 1: Find your Team ID (Microsoft 365 Group ID)

Head over to the Azure Portal, and under Groups, filter by group type ‘Microsoft 365’ and find your group/team ID (Object Id):

Step 2: Create the Flow

Create a manually Triggered flow having the Plan name input and also as a variable. Create another variable to store the Tab Name (in this case we concatenate ‘Planner – ‘ to the Plan name) and the Team ID (which you got from Azure):

Now we need to retrieve the ID of the General channel. For that, use the Teams connector to list all channels from the Team you chose, filter the channels by name to obtain the Id of the channel and save the result in a variable:

The formula for the Channel ID (First item from filtered results, considering a renamed Filter array action as above):

first(body('Filter_array_-_Channels'))['Id']

3: Use the HTTP with Azure AD connector

In the actions list, search for ‘HTTP with Azure AD’ and click on the ‘Invoke an HTTP Request’ action. You will be prompted to provide details about the application you will be connecting to.

For Microsoft Graph you can simply use https://graph.microsoft.com as both ‘Base Resource URL’ and ‘Azure AD Resource’ URI.

Click sign in to create the connection.

4: Creating the Plan and parsing the created plan data

To create the plan we run a post call to Microsoft Graph as below:

We can then parse the response using the ‘Parse JSON’ action to easily manipulate the results in the rest of the flow:

You can use the following schema to parse the Request Body:

{
    "type": "object",
    "properties": {
        "@@odata.context": {
            "type": "string"
        },
        "@@odata.etag": {
            "type": "string"
        },
        "createdDateTime": {
            "type": "string"
        },
        "owner": {
            "type": "string"
        },
        "title": {
            "type": "string"
        },
        "id": {
            "type": "string",
            "description": "The Plan ID"
        },
        "createdBy": {
            "type": "object",
            "properties": {
                "user": {
                    "type": "object",
                    "properties": {
                        "displayName": {},
                        "id": {
                            "type": "string"
                        }
                    }
                },
                "application": {
                    "type": "object",
                    "properties": {
                        "displayName": {},
                        "id": {
                            "type": "string"
                        }
                    }
                }
            }
        }
    }
}

Then save the plan ID in a variable as below:


5: Adding the Plan as a Teams a Tab

Now with the Plan ID, Team ID, and Channel ID in hands, you need run a POST request in the endpoint related to the team/channel/tabs you want to create the new tab, so that you add Planner as a tab to the General channel of the Team, and specify the Plan to use in that tab, as in the following image:

As long as that all the variables in your flow respect the names of the sample pictures above, you can copy the below code and paste into your ‘Invoke an HTTP request’ action’s body:

  {
    "displayName": "@{variables('TabName')}",
    "teamsApp@odata.bind": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/com.microsoft.teamspace.tab.planner",
    "configuration": {
        "entityId": "@{variables('ChannelID')}",
        "contentUrl": "https://tasks.teams.microsoft.com/teamsui/{tid}/Home/PlannerFrame?page=7&auth_pvr=OrgId&auth_upn={userPrincipalName}&groupId={groupId}&planId=@{variables('PlanID')}&channelId={channelId}&entityId={entityId}&tid={tid}&userObjectId={userObjectId}&subEntityId={subEntityId}&sessionId={sessionId}&theme={theme}&mkt={locale}&ringId={ringId}&PlannerRouteHint={tid}",
        "removeUrl": "https://tasks.teams.microsoft.com/teamsui/{tid}/Home/PlannerFrame?page=13&auth_pvr=OrgId&auth_upn={userPrincipalName}&groupId={groupId}&planId=@{variables('PlanID')}&channelId={channelId}&entityId={entityId}&tid={tid}&userObjectId={userObjectId}&subEntityId={subEntityId}&sessionId={sessionId}&theme={theme}&mkt={locale}&ringId={ringId}&PlannerRouteHint={tid}",
        "websiteUrl": "https://tasks.office.com/{tid}/Home/PlanViews/@{variables('PlanID')}?Type=PlanLink&Channel=TeamsTab"
    }
}

Results

After running this Flow, a Plan will be added to the General tab of the specified team:

References

Create planner plans – Microsoft Graph

9 comments

  1. Hey mate!

    Thank you so much for the right up, I’m learning PA at the moment and this is fantastic.
    Could you assist me though, I’m getting an error on the Initialize Variable: ChannelID part.
    Error:
    Correct to include a valid reference to ‘Filter_array_-_Channels’ for the input parameter(s) of action ‘Initialize_variable:_Channel_ID’.

    1. Hey Chad, is your filter array action named exactly as on the screenshot? It needed to be in order to work properly

  2. You’re a wizard. Totally going to attempt this, bash my head against my keyboard, swear, google some more, do 100 errors. But I will emergy VICTORIOUS. I have faith.

    1. Hey Daniel,

      This was possible a while ago, but unfortunately now only with Premium connectors. Graph API support on Standard connectors is limited to certain endpoints.

Leave a Reply

Your email address will not be published. Required fields are marked *