Saturday 11 September 2021

Get On-premises extension attributes from Azure AD using Power Automate

If you would like to be able to access the custom extensionattribute properties from Power Automate flow, you would have to use the Graph API to grab the custom attributes as at the moment, the Office365 connector does not show any of the custom properties. 

If you want to call Graph API from Power Automate Flow, you would require below:

  • Administrative access to Azure AD of Office 365 tenant
  • ‘Invoke an HTTP request’ or HTTP request which are premium.

https://www.lee-ford.co.uk/using-flow-with-graph-api/ 

https://www.c-sharpcorner.com/article/calling-graph-api-from-power-automate-flow/

What if you don’t have premium license for HTTP request? 

  1. You can use Office 365 connector (Get user profile(V2)) and add the fields you want.
  2. To parse the output, let's add another action after Microsoft Graph API call. Search for Parse JSON and select "Parse JSON".
  3. In the JSON action, under content, select Body (User from Graph API) content from the Get User profile(V2). And click on 'Generate sample popup'.
  4. In the popup screen, you can copy paste the copied raw output of the ‘Get User Profile(V2)’ into Parse JSON schema.
  5. Now that we have parsed the JSON, so we can can use those extracted attributes using compose action.
  6. Add 'Compose' and select 'externsionattrubute1' from the Dynamic Content.
  7. Add the compose output to Update item action to update the field value.
  8. For the other items I have added the expression to list item instead of adding compose actions.

body('Parse_JSON')?['mobilePhone']
body('Parse_JSON')?['employeeId']
body('Parse_JSON')?['onPremisesExtensionAttributes']?['extensionAttribute2']
body('Parse_JSON')?['onPremisesExtensionAttributes']?['extensionAttribute3']
body('Parse_JSON')?['onPremisesExtensionAttributes']?['extensionAttribute4']

No comments:

Post a Comment