script granting pim admin role in Azure AD with MFA

Darryl 256 Reputation points
2021-05-27T14:34:44.023+00:00

Hi,

I'm trying to script some maintenance tasks in Exchange, and to make the changes I need to grant myself the exchange admin role in PIM and authenticate using MFA.

I've followed this but I still get an error relating to MFA:

Open-AzureADMSPrivilegedRoleAssignmentRequest : Error occurred while executing
OpenAzureADMSPrivilegedRoleAssignmentRequest
Code: RoleAssignmentRequestPolicyValidationFailed
Message: The following policy rules failed: ["MfaRule"]

I'm not sure if the clientid I've used is right, where do I get this from? does that relate to an specific application?

Thanks

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,504 questions
Microsoft Entra
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.