Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Add-PnPAzureADServicePrincipalAppRole not working in azure government #4420

Open
5 tasks
jrudley opened this issue Oct 11, 2024 · 4 comments
Open
5 tasks
Labels
bug Something isn't working

Comments

@jrudley
Copy link

jrudley commented Oct 11, 2024

Reporting an Issue or Missing Feature

Add-PnPAzureADServicePrincipalAppRole -Principal "id" -AppRole "Group.Read.All" -BuiltInType MicrosoftGraph
Get-PnPAzureADServicePrincipal: Service principal not found

Expected behavior

it adds the app role

Actual behavior

Get-PnPAzureADServicePrincipal: Service principal not found

Steps to reproduce behavior

create azure function
enable managed identity
run Add-PnPAzureADServicePrincipalAppRole -Principal "id" -AppRole "Group.Read.All" -BuiltInType MicrosoftGraph

What is the version of the Cmdlet module you are running?

(you can retrieve this by executing Get-Module -Name "PnP.PowerShell" -ListAvailable)
2.12.0

Which operating system/environment are you running PnP PowerShell on?

  • [ X] Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • Azure Functions
  • Other : please specify
@jrudley jrudley added the bug Something isn't working label Oct 11, 2024
@KoenZomers
Copy link
Collaborator

I don't have access to such an environment myself, which makes it really hard to troubleshoot. As far as I can judge from the code, the cmdlet you use implements the logic properly to deal with sovereign clouds. Can you check and confirm that if you run:
Get-PnPConnection

That for you it returns the property AzureEnivronment with the proper value? I.e. USGovernment, USGovernmentDoD or USGovernmentHigh?

@jrudley
Copy link
Author

jrudley commented Oct 11, 2024 via email

@jrudley
Copy link
Author

jrudley commented Oct 11, 2024

I ended up switching back to an client id and cert. I manually created the managed identity permissions and had too many issues.

@allanwei
Copy link

Add-PnPAzureADServicePrincipalAppRole: Verification code expired before contacting the server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants