cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

PowerShell scripts with Service Principal As Member scope

Hi,

I have a question regarding PowerShell and Service Principal (not necessarilly defined as Admin but as Member).
So to keep a long story short, I managed to replicate most of the methods found on Power BI REST API documentation site in PowerShell scripts using Invoke-RestMethod and basically the same url pattern.
So my first main challenge was to be able to generate a bearer accesstoken
which I could pass as a token string parameter in header.
Since I worked in automation context, I needed to provide credentials in a silent mode without always
calling authentication login prompt everytime I would call a method request.
So I opted for Service Principal to provide credentials which managed to do the job.
Service Principal was created in a AAD Security group then added as Admin in Workspaces. That worked. No problem there.

Now my main concern is could the same scenario be possible with Service Principal as Member. (avoiding to end up with 401 kind of thing with unsufficient...) Also I know SP definition doesn't really deal with Roles definition as with users...

 

Anyone managed to come with a solution? I'm not looking for code, mainly a POC logic. I can deal with the rest.

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Visitor

Re: PowerShell scripts with Service Principal As Member scope

Thanks I was already aware of that information.

I managed to find an answer as I was able to run PS scripts with Service Principal defined as Member instead of Admin.
Perhaps I should have rephrased my question as I believe the whole crucial aspect here deals more with the definiton of Security Group infrastructure. Anyway thanks for the reply. 

View solution in original post

2 REPLIES 2
Highlighted
Community Support
Community Support

Re: PowerShell scripts with Service Principal As Member scope

Hi @MawashiKid2 ,

 

Maybe this document can give you a few ideas? 

Embed Power BI content with service principal and an application secret 

 

If it can't help, you could try to create a support ticket to get the dedicated support from MS. 

How to create a support ticket in Power BI  

 

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Frequent Visitor

Re: PowerShell scripts with Service Principal As Member scope

Thanks I was already aware of that information.

I managed to find an answer as I was able to run PS scripts with Service Principal defined as Member instead of Admin.
Perhaps I should have rephrased my question as I believe the whole crucial aspect here deals more with the definiton of Security Group infrastructure. Anyway thanks for the reply. 

View solution in original post

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Upcoming Events

Upcoming Events

Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.

Community Summit Australia – Join Online!

Community Summit Australia – Join Online!

Be a part of the leading Microsoft Business Applications digital event, curated for the APAC community.

Top Kudoed Authors