skip to Main Content

I want to delete conditional access policy from Microsoft Graph Powershell.

I found this to do from Graph api

DELETE
https://graph.microsoft.com/v1.0/identity/conditionalAccess/policies/{id}

But how to find the command for this in Microsoft Graph Powershell.

PS: I connected to Graph from Powershell with Connect-MgGraph

TIA

2

Answers


  1. You can use this Remove-MgIdentityConditionalAccessPolicy cmdlet to remove the conditional access policy.

    Remove-MgIdentityConditionalAccessPolicy
          -ConditionalAccessPolicyId <String>
          [-IfMatch <String>]
          [-PassThru]
          [-WhatIf]
          [-Confirm]
          [<CommonParameters>]
    

    Refer to this documentation to know more about the cmdlet and also the accepted input values to those parameters.

    Here is the MG graph PowerShell cmdlets documentation.

    Login or Signup to reply.
  2. I tried in my environment and got below results:

    Initially I have an conditional policy like Require MFA to user administrator in my portal.

    Portal:

    enter image description here

    Commands:
    I tried with below commands and I removed a conditional policy successfully.

    Connect-MgGraph -Scopes 'Policy.ReadWrite.ConditionalAccess', 'Policy.Read.All'
    Get-MgIdentityConditionalAccessPolicy
    $conditionalAccessPolicyId="Id"
    Remove-MgIdentityConditionalAccessPolicy -ConditionalAccessPolicyId $conditionalAccessPolicyId
    

    Console:
    enter image description here

    Portal:
    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search