New-AzureADPolicy

In this Azure PowerShell article, we will discuss the syntax and usage of the New-AzureADPolicy PowerShell command with examples of how to use this command.

New-AzureADPolicy

This is an excellent PowerShell command that can help you to create a brand new policy in your Azure Active Directory.

Syntax

Below is the syntax of the New-AzureADPolicy PowerShell command.

New-AzureADPolicy
   -Definition <System.Collections.Generic.List`1[System.String]>
   -DisplayName <String>
   [-IsOrganizationDefault <Boolean>]
  -Type <String>

Let’s quickly discuss an example of how to use the New-AzureADPolicy PowerShell command.

Example:

You can execute the below PowerShell command to help you create a policy name as “TsInfoPolicy”.

$mypolicy = New-AzureADPolicy -Definition @('{"TokenLifetimePolicy":{"Version":1,"AccessTokenLifetime":"02:00:00"}}') -DisplayName "TsinfoPolicy" -IsOrganizationDefault $false -Type "TokenLifetimePolicy"
$mypolicy

After executing the above PowerShell command, the Policy was created successfully, and I got the below-expected output.

Id                                   DisplayName  Type                IsOrganizationDe
                                                                      fault           
--                                   -----------  ----                ----------------
8a3c7b96-ef63-4419-864d-fb0bc42129e1 TsinfoPolicy TokenLifetimePolicy False           

You can see the same output below

New-AzureADPolicy

Once the policy is created successfully, you can use the Get-AzureADPolicy PowerShell command to retrieve the policy details you created.

The Set-AzureADPolicy PowerShell command to update the Azure Active Directory policy.

New-AzureADPolicy PowerShell – Video Tutorial

Check out a video tutorial on the New-AzureADPolicy PowerShell command.

Final Thoughts

In this Azure PowerShell article, we discussed the syntax and usage of the New-AzureADPolicy PowerShell command with an example of how to use the New-AzureADPolicy command. Thanks for reading this article !!!