UnAuthorized when accessing Security & Compliance PowerShell - Stack Overflow

I'm trying to create a Powershell script runbook to periodically export Purview Explorer Activity

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条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信