Query Azure AD (Connect-AzureAD) unattended with Azure App Registration certificate PFX
HTML-код
- Опубликовано: 11 сен 2024
- Demo showing how to query Azure AD in PowerShell. Walk each step with full PowerShell source code available.
1) Execute "Connect-AzureAD" with admin user
2) Create self signed certificate PFX for unattended login
3) Create new App Registration
4) Grant permission "User.ReadAll" to MS Graph API
5) Execute "Connect-AzureAD" with unattended certificate PFX login
6) Execute query "Get-AzureADUser" to display results
Please leave comment with suggestions and questions. Cheers.
After 2 days in labyrinthing on the net finally I found you. Thank you! Job done! :)
Wish you had included the powershell script. Hard to read on the monitor and this is such a great solution!
That's what I needed Thanks PAL 👍
excellent content, thank you! :)
Thank you Jeff!
I tried all of these, but the moment I deleted the thumbprint saved in mmc, everything started to fail. It says that it cannot find the thumbprint, even though we uploaded it in the App registration. What is the purpose of the App Registration's thumbprint? If we deploy a script with this authentication method, to let's say, Azure Automation, will the script still work? Or will it start looking for that local thumbprint?
Excellent, just what I was looking for. Well explained too. Where can I find the source code? Thank you.
Awesome. Thank you. Code at github.com/spjeff/spadmin/blob/master/Connect-AzureAD.ps1
@@spjeff RIP That link
@@spjeff What happened? All your Github content is gone so is the skript?
instead of certificate thumbprint can we use Client Secret to connect ?
from where in can get the script?
Thank you for this. It really looks like it would solve my needs. I attach well and it looks like all is well, but when I finally attach I then get this response: (X's and ?'s to protect the innocent)
Get-AzureADUser : Error occurred while executing GetUsers
Code: Authorization_RequestDenied
Message: Insufficient privileges to complete the operation.
RequestId: XXXXXXX-????-XXXX-????-XXXXXXXXXXXX
DateTimeStamp: Wed, 04 Jan 2023 20:13:24 GMT
HttpStatusCode: Forbidden
HttpStatusDescription: Forbidden
HttpResponseStatus: Completed
At line:1 char:10
+ $users = Get-AzureADUser
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-AzureADUser], ApiException
+ FullyQualifiedErrorId : Microsoft.Open.AzureAD16.Client.ApiException,Microsoft.Open.AzureAD16.PowerShell.GetUser