最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

UnAuthorized when accessing Security & Compliance PowerShell - Stack Overflow

programmeradmin0浏览0评论

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.

发布评论

评论列表(0)

  1. 暂无评论