microsoft / microsoft/powerbi-powershell

Permissions needed for Service Principal

Open
#51 31 comments 0 reactions 1 assignee View on GitHub

@CodeCyclone is already working on this.

Since Jul 19, 2018.

external bug
Dominant language
C#
Stars
413
Forks
134
Avg merge
33m
Merged PRs (30d)
1

Description

Is there a guide on how to create an Azure AD registered app (aka Service Principal) that has permissions to use these powershell commands?

I created an 'App Registration' in our Azure Active Directory.

I had our global admin grant it the 'Read and write all content in tenant' and 'View all content in tenant' permissions

I login successfully:

$tenantId = '<redacted>'
$applicationId = '<redacted>'
$key = '<redacted>'

$secureKey = ConvertTo-Securestring -String $key -AsPlainText -Force
$credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $applicationId,$secureKey

Connect-PowerBIServiceAccount -ServicePrincipal -Credential $credential -Tenant $tenantId

Environment : Public
TenantId    : 
ClientId    : <redacted>
Password    : ********

But I get an unauthorized error from any of the commands:

PS> Get-PowerBIReport
Get-PowerBIReport : Operation returned an invalid status code 'Unauthorized'

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.