I have been using Graph API in Powershell using application permission for a while now and I would like to explore how delegated permissions work.
I come across the website which is great. https://morgantechspace.com/2021/10/how-to-register-and-configure-azure-ad-application-from-azure-ad-portal.html
I basically copy and run the code below after I created the app. When I ran the code, a MFA prompt popped up which is what I expected. However, I was never able to choose another account to log on. It always defaults to the account which I used to run Powershell. Is there anyway I could get around it?
$TenantId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
$AppClientId="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
$MsalParams = @{
ClientId = $AppClientId
TenantId = $TenantId
Scopes = "https://graph.microsoft.com/User.Read"
}
$MsalResponse = Get-MsalToken @MsalParams
$AccessToken = $MsalResponse.AccessToken#Provide Application (client) Id of your app