New-AzureADMSNamedLocationPolicy
Creates a new named location policy in Azure Active Directory.
Syntax
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.
Type: | List<T>[Microsoft.Open.MSGraph.Model.CountriesAndRegion] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DisplayName
Specifies the display name of a named location policy in Azure Active Directory.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Id
{{ Fill Id Description }}
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-IncludeUnknownCountriesAndRegions
Specifies the includeUnknownCountriesAndRegions value for the named location policy in Azure Active Directory.
Type: | Boolean |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-IpRanges
Specifies the ip ranges of the named location policy in Azure Active Directory.
Type: | List<T>[Microsoft.Open.MSGraph.Model.IpRange] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-IsTrusted
Specifies the isTrusted value for the named location policy in Azure Active Directory.
Type: | Boolean |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-OdataType
Specifies the odata type of a named location policy object in Azure Active Directory.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Notes
See the migration guide for New-AzureADMSNamedLocationPolicy to the Microsoft Graph PowerShell.