Open worldsdream opened 9 months ago
This is very easy to do using the all purpose Invoke-mgGraphRequest cmdlet. Just figure out what values you want to set and put them in the body hashtable. Leave out ones you don't want to modify.
invoke-mgGraphRequest -Uri 'https://graph.microsoft.com/beta/users/[UPN OR ID]/authentication/signInPreferences' -Method PATCH -Body @{systemPreferredMethodForSecondaryAuthentication = "push"; isSystemPreferredAuthenticationMethodEnabled= "false"; userPreferredMethodForSecondaryAuthentication= "push"}
Hi @worldsdream have you tried using Invoke-MgGraphRequest
as per @ioamnesia's suggestion?
@timayabi2020 It works with Invoke-RestMethod.
But isn’t the graph sdk so we can interact with Graph using PowerShell?
@timayabi2020 It works with Invoke-RestMethod.
But isn’t the graph sdk so we can interact with Graph using PowerShell?
Invoke-MgGraphRequest
is a commandlet within the Microsoft Graph PowerShell SDK. See documentation here
I thought that we will get an option. For example with “Get-“.
@worldsdream please update to the latest SDK version and use Update-MgBetaUserAuthenticationSignInPreference
. An example is available here https://learn.microsoft.com/en-us/powershell/module/microsoft.graph.beta.identity.signins/update-mgbetauserauthenticationsigninpreference?view=graph-powershell-beta which you can try out.
Is your feature request related to a problem? Please describe. We can’t set authentication methods with Graph SDK. We have to use entra admin center or https://learn.microsoft.com/en-us/graph/api/authentication-update?view=graph-rest-beta&tabs=http
Describe the solution you'd like A feature to get the option for setting the authentication methods with Microsoft Graph PowerShell SDK.
Describe alternatives you've considered We can use: https://learn.microsoft.com/en-us/graph/api/authentication-update?view=graph-rest-beta&tabs=http