az ad user update
to update the user’s MFA settings.az ad user update --id <user-object-id> --force-change-password-next-login true
az ad policy password update
to update the password policy settings.az ad policy password update --id <policy-object-id> --password-lifetime 90 --password-history 5
az ad policy update
to enable the sign-in risk policy.az ad policy update --id <policy-object-id> --is-enabled true
<user-object-id>
with the actual user’s object ID, <policy-object-id>
with the actual policy’s object ID, and adjust the command parameters as per your requirements.
azure-identity
library to authenticate with Azure Active Directory.azure-mgmt-graphrbac
library to interact with the Azure AD Graph API.UserOperations
class to reset the password for a specific user.azure-identity
library to authenticate with Azure Active Directory.azure-mgmt-graphrbac
library to interact with the Azure AD Graph API.UserOperations
class to enable MFA for a specific user.azure-identity
library to authenticate with Azure Active Directory.azure-mgmt-graphrbac
library to interact with the Azure AD Graph API.GroupOperations
class to add a user to a specific group.azure-identity
and azure-mgmt-graphrbac
) before running these scripts.