Edit

Share via


New-AzureADMSNamedLocationPolicy

Creates a new named location policy in Azure Active Directory.

Syntax

Default (Default)

New-AzureADMSNamedLocationPolicy
    [-OdataType <String>]
    [-Id <String>]
    [-DisplayName <String>]
    [-IpRanges <System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.IpRange]>]
    [-IsTrusted <Boolean>]
    [-CountriesAndRegions <System.Collections.Generic.List`1[Microsoft.Open.MSGraph.Model.CountriesAndRegion]>]
    [-IncludeUnknownCountriesAndRegions <Boolean>]
    [<CommonParameters>]

Description

This cmdlet allows an admin to create new named location policy in Azure Active Directory. Conditional access policies are custom rules that define an access scenario.

Note

Named Locations created by PowerShell will only display in Named locations (preview), you can't see them in them in the old view.

Examples

Example 1: Creates a new Ip named location policy in Azure AD.

PS C:\> $ipRanges = New-Object -TypeName Microsoft.Open.MSGraph.Model.IpRange
          PS C:\> $ipRanges.cidrAddress = "6.5.4.3/32"
          PS C:\> New-AzureADMSNamedLocationPolicy -OdataType "#microsoft.graph.ipNamedLocation" -DisplayName "IP named location policy" -IsTrusted $false -IpRanges $ipRanges

          OdataType               : #microsoft.graph.ipNamedLocation
          Id                      : 6b5e999b-0ba8-4186-a106-e0296c1c4358
          DisplayName             : IP named location policy
          CreatedDateTime         : 2019-09-26T23:12:16.0792706Z
          ModifiedDateTime        : 2019-09-27T00:12:12.5986473Z
          IsTrusted               : false
          IpRanges                : {
                                      class IpRange {
                                        CidrAddress: 6.5.4.3/32
                                      }
                                    }

This command creates a new IP named location policy in Azure AD.

Example 2: Creates a new country or region named location policy in Azure AD.

PS C:\> New-AzureADMSNamedLocationPolicy -OdataType "#microsoft.graph.countryNamedLocation" -DisplayName "Country named location policy" -CountriesAndRegions "IN" -IncludeUnknownCountriesAndRegions $false

          OdataType                         : #microsoft.graph.countryNamedLocation
          Id                                : 13975bae-089f-4358-8da3-cc262f29276b
          DisplayName                       : Country named location policy
          CreatedDateTime                   : 2019-09-26T23:12:16.0792706Z
          ModifiedDateTime                  : 2019-09-27T00:12:12.5986473Z
          CountriesAndRegions               : {IN}
          IncludeUnknownCountriesAndRegions : False

This command creates a new country or region named location policy in Azure AD.

Parameters

-CountriesAndRegions

Specifies the countries and regions for the named location policy in Azure Active Directory.

Parameter properties

Type:

List<T>[Microsoft.Open.MSGraph.Model.CountriesAndRegion]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DisplayName

Specifies the display name of a named location policy in Azure Active Directory.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Id

{{ Fill Id Description }}

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-IncludeUnknownCountriesAndRegions

Specifies the includeUnknownCountriesAndRegions value for the named location policy in Azure Active Directory.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-IpRanges

Specifies the ip ranges of the named location policy in Azure Active Directory.

Parameter properties

Type:

List<T>[Microsoft.Open.MSGraph.Model.IpRange]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-IsTrusted

Specifies the isTrusted value for the named location policy in Azure Active Directory.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-OdataType

Specifies the odata type of a named location policy object in Azure Active Directory.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Notes

See the migration guide for New-AzureADMSNamedLocationPolicy to the Microsoft Graph PowerShell.