I'm trying to create a Powershell script runbook to periodically export Purview Explorer Activity data without the need of an interactive login screen. In order to access that cmdlet (Export-ExplorerActivityData), I need to connect to the Security & Compliance Powershell. I'm using the following code to connect:
Connect-ExchangeOnline -AccessToken $accessToken -Organization "my.onmicrosoft"
The Access Token request code I'm using looks like this:
$accessToken = (Get-AzAccessToken -ResourceUrl "; -AsSecureString -ErrorAction Stop).Token
When I run this command, it returns the error UnAuthorized and I cannot access Export-ExplorerActivityData cmdlet.
According to the Microsoft documentation the runbook running this cmdlet needs to have at least Security Reader permissions. I have setup the following permissions: Runbook: Security Reader, App Compliance Automation Reader, Reader Azure Account: Owner, Security Reader Subscription: Security reader, Security Admin
I expected it to have enough permissions, but it returns an error UnAuthorized.
My Azure account has the M365 E5 Compliance and M365 E3EEA licenses active, so I can access Purview's Data Loss Prevention.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745156865a4614176.html
评论列表(0条)