The other day, I was building out some Power Automate flows to test the process I was building for a custom disposition. When I went to assign the flow to the retention label, I find that the custom flow is missing from the retention label flow selection list. The fix is pretty straightforward, and Microsoft does mention it, but I felt it necessary to pull it out and flag it directly in case others have the same issue.
Custom Flow Is Missing From the Retention Label Flow Selection List
To provide a bit of background to this, I was working on a new flow for another post, and because things aren’t immediate with Purview RM I wanted to get things quickly started while I wrote the blog post. So, I created the new workflow with a trigger on the M365 Compliance connector and saved the flow:
It then and went and created a label with the following properties:
- Name: Team Communication
- Description for users: Information created for consumption by functional groups within the organization.
- Description for admins: Blank
- Label settings: Retain items forever or for a specific period
- Retention period: 1 day
- Trigger: When items are created
- Do not declare it a record
- After retention: Run a Power App
As you can see from the following screenshot, the Power App created above is not there.
So after some investigation, I found the culprit. Because the Microsoft 365 Compliance connector is premium, I added a developer’s license to my tenant. However, the developer license is not added to the default environment in the Power Platform system. As a result, my flow did not exist in the default environment. Microsoft has a single bullet that mentions this situation on their page on the compliance connector. I’ll quote it here: “If your chosen flow uses an environment type other than Default, you must use PowerShell to create the retention label, and use the FlowId parameter.” So this means that I can’t use the GUI interface to create my label. So off to PowerShell, I go. I’ll let you read up on the New-ComplianceTag command at your leisure, but will provide the command I used to create this particular label to assist. But first, to get the Flow ID, go to the details of your flow and grab it from there. You’ll find it in the address bar of the flow details. It is found between /flows/ and /details/ in the address.
The command to add the necessary flow is:
New-ComplianceTag -Name "Team Communication" -Comment "Information created for consumption by functional groups within the organization." -IsRecordLabel $false -RetentionAction KeepAndDelete -RetentionDuration 1 -RetentionType CreationAgeInDays -FlowId "f80c1fe5-c87d-4d08-81a8-400aa38d3054"
When the command is successful, it returns the data from the newly created retention label:
And going into Purview, we can see the newly created retention label
Notice that Action is “No action”? If we go into the label settings, we’ll see that the flow has been successfully attached.
Hopefully, this helps anyone who is having a similar issue. Stay tuned as I am about to release a blog that explains the snippet you see in the screenshots here.
Thanks for reading!