Integration of Microsoft Purview and Power Automate (Part 2)
In the second part of our series Leveraging Power Automate with Microsoft Purview were going to do a walkthrough of configuring Purview Communicat...

In the second part of our series (Leveraging Power Automate with Microsoft Purview), weâre going to do a walkthrough of configuring Purview Communication Compliance with Power Automate.
Part 1: Leveraging Power Automate with Microsoft Purview (Part 1)
Part 2: Integration of Microsoft Purview and Power Automate (this post)
Part 3: Integrating Microsoft Purview and Power Automate: Implementation Best Practices
The Scenario
As an organization, we want to capture and act if there is any communication that include Offensive or threatening language. This is key to maintaining a professional and acceptable place of business. This can include people inside of the business and outside. When this happens, we want to notify the manager and in this case our security team as well. Expanding this scenario, itâs obvious that this should go to Human Resources as well. However, weâll keep it simple from this post.
Requirements & Recommendations
For this to all work, youâll need the following:
Licensing
Both Power Automate and Purview Communication Compliance are license that are bundled with the following:
- Microsoft 365 E5/A5/F5/G5 subscription (paid or trial version)
- Microsoft 365 E3/A3/F3/G5 subscription + the Microsoft 365 E5/A5/F5/G5 Compliance add-on
- Microsoft 365 E3/A3/F3/G5 subscription + the Microsoft 365 E5/A5/F5/G5 Insider Risk Management add-on
There are other options as well. Links to those resources are later in this post under âReferences.â These can be complex and where Agile IT can help with your licensing needs.
Roles and Permissions
Not going to go deep here, but if youâre doing development of this and following along, youâll need this access OR work with a peer/team to configure the Purview Policies as needed. As we go along, weâll try to call these out.
It typically starts with âCompliance Administratorâ setting this up. This is done via Entra ID (aka Azure Active Directory). When Communication Compliance is being used, youâll configure within Purview which people or security groups will be assigned to the roles that it understands.
Purview Communication Compliance Policy
First, weâll want to create a policy specifically to handle the scenario where Purview is watching for this kind of interaction. There is a default template for this and maybe you have your own, but weâll walk through what is configured for this scenario to work for us.
Step 1: Create a new Communication Compliance policy
First, letâs navigate to the Communication compliance policy section
As you can see below, there are a few pre-defined policies to select. Weâll use âCustomâ
Here is where youâll name the policy and give it a description.
Click Next (not shown in screenshot). Now we can select the users that his applies to, who to exclude, and who can review the communication from those that meet the conditions. We wonât go into all of that for this post.
Click Next (not shown in screenshot). We can now specify where we want to detect this information to apply the policy. Here, we selected all three in Microsoft 365: Exchange, Teams, Viva Engage.
Click Next (not shown in screenshot). Lastly, we set the conditions and direction of this information.
Click Next (not shown in screenshot). Now we can review all we configured. We can even see it has a recommendation. The below screenshot doesnât include all on the page, but enough for you to get the point of it.
Click Next (not shown in screenshot). And then click Done.
At this point, we have what we need. Youâll later see in the dashboard that the status is âActivatingâ which could take a few hours.
Create Power Automate
Now letâs go through the steps of creating a Power Automate that works with the information from Purview.
Weâll walk through the main parts, but this wonât be a click by click set of instructions. However, youâll have enough detail to create this on your own.
Step 1: Create a new Power Automate Flow
Letâs name it: Purview Communication Compliance Violation
Step 2: Add a trigger
A trigger is the starting point for our flow. Weâre going to use a trigger thatâs within the âMicrosoft 365 complianceâ connector.
Click, âFor a selected communication compliance itemâ
Nothing else to do with the trigger. Letâs move on to adding some actions to handle the information provided by the trigger.
Step 3: Get the metadata for the violation
Add the action âGet communication compliance violation metadataâ which is also in the âMicrosoft 365 complianceâ connector. The trigger just says that something happened, but now we want to actually get the details about the violation.
In order for the metadata to understand which item kicked off the trigger to fetch the actual metadata for it, weâll use âdynamic content.â Weâll do this in other places as well. This post isnât a full class on how to do Power Automate, so weâll start to summarize things, but the pictures should provide more context.
In the above screenshot, youâll see that the trigger is provide us some dynamic content.
Once weâve populated the metadata action to pull information based on the item that kicked off the trigger, letâs work on communicating this issue.
Step 4: Get the managers information
Now this is where there are a few tricks to use for this scenario. We want to send a message to the manager of the user and our SOC team. But what if the user doesnât have a manager? Maybe itâs just not set in Entra ID (aka Azure Active Director), itâs a guest user, or the violator of the policy is a guest. Whatever the case, they donât have a manager assigned. So we need to handle that.
To do this, weâre going to use âsectionâ which is part of the âControlâ connector within Power Automate. Soon, youâll see why.
Now letâs add in the Scope action.
Weâll now rename the action itself so that it helps with our documentation of this. Letâs name the action âTry- Get Managerâ
Once youâve completed that step (no screenshot with just that part), weâll want to add an action to get the manager for the user.
Step 5: Get the Manager
To get the manager of the user, weâre going to use the âOffice 365 users (v2)â connector and use the âGet manager (V2)â action.
Next, weâll want to configure the action to pull the manager based on the user that created the violation. Weâll leverage Dynamic Content again to connect the dots here.
As you can see in the screenshot above, weâre taking the Dynamic Content of âviolatedUserEmailâ from the âGet communication compliance violation metadataâ action and then adding that to the âGet manager (V2)â action.
The reason we put this in a scope, is that if/when this fails because the user doesnât have a manager set, then we want to make a decision what to do without the entire flow breaking.
Step 6: Take action if there is no manager
Letâs add our next action which is to send a message to our SOC team even if there is no manager.
First, add a new Scope action and rename to âNo Manager Foundâ
Weâre now going to add an action that leverages the âMicrosoft Teamsâ connector.Â
And weâre going to use the âPost message in a chat or channelâ action.
Weâre going to send a message using the flow bot, into a channel named, âSOC Teamâ within the âGeneralâ channel. We can customize the message and include information about the violation. You can see in the screenshot below that weâve put in some text and some dynamic content.
Last step here is to finally put our âScopeâ components to work!
On the âNo Manager Foundâ scope, click on the three dots and select, âConfigure run afterâ like the screenshot below.
This is where weâll configure the âNo Manager Foundâ scope to run ONLY if the âTry- Get Managerâ scope fails.
Step 7: Take action if there is a manager
To fast forward, create a new scope named, âHas Managerâ and then weâll add the âPost message in a chat or channelâ action within the âMicrosoft Teamsâ connector. Also, rename the action to âPost message to managerâ
Then youâll add and configure the same âPost message in a chat or channelâ in the âMicrosoft Teamsâ connector right afterwards. Also, rename the action to âPost message to SOCâ
Now you should look like the following.
Nothing new here since youâve been following along. However, you can see that our message to the SOC Team provides additional dynamic content that came from the âGet manager (V2)â action.
Lastly, we need to configure the âHas Managerâ scope to only run IF the previous action (in this case our scope if there was no manager) is skipped.
âHas Managerâ should run after âNo Manager Foundâ has been skipped.
Thatâs it! But now we need to see it in action.Â
Test
Now that we have our flow, we want to test this out. Letâs go back to Compliance Center and put this thing to work. While weâre testing this out per violation, the automation will run as new violations occur.
We can see here that our policy has four pending issues. This is great for testing this out.
After clicking on the policy, letâs select one of the violations.
In this example, Alex Wilber is not being very nice. After selecting that violation, click on the âAutomateâ button thatâs highlighted in the navigation bar as shown in the screenshot above.
Now weâll get a sidebar menu where we can see other Power Automate flows that uses a connector that Purview Communication Compliance understands and even a template. It kinda looks like what we built here, but ours/this is better. đ
Click on the âRun flowâ dropdown and then select our flow.
Now youâll see that itâs check to ensure that the flow that will run has the permissions required. Thatâs not covered in this post.
Scroll down (I have to say it because if your browser window is a bit small, you wonât see the âContinueâ button. And click âContinue.â And then âRun flow.â
Now that flow is running, letâs go back to Power Automate and see it in action!
When we first open our flow, weâll see some good news waiting for us!
Go ahead and click on the date so we can inspect what happened.
One thing you can see is that it looks like the user had a manager assigned. Thus, the âNo Manager Foundâ was skipped. And to show you a little of the final output, this even shows you the output of data from this flow.
Now letâs check out the SOC Team via Microsoft Teams to see what the output was there.
As you can see, the post to the SOC team was posted by the flow bot exactly as we expected.
Finally, letâs see what the manager (Miriam Graham) see via Microsoft Teams.
Conclusion
Purview is a powerful service that allows organizations to define corporate or industry compliance policies to reduces a variety of risks and penalties. Leveraging Power Automate with Purview can capture specific tasks and route them to the right people and teams to act. This reduces the burden of the IT and/or Compliance team to be the only oneâs looking and then taking manual actions.
References:
- Get started with communication compliance: https://learn.microsoft.com/en-us/purview/communication-compliance-configure
- Power Automate Connectors
- Microsoft 365 compliance: https://learn.microsoft.com/en-us/connectors/microsoft365compliance/
- Microsoft Purview Communication Compliance licensing: https://learn.microsoft.com/en-us/purview/communication-compliance-configure#subscriptions-and-licensing