1. Packages
  2. Azure Active Directory (Azure AD)
  3. API Docs
  4. NamedLocation
Azure Active Directory (Azure AD) v6.4.0 published on Monday, Apr 7, 2025 by Pulumi

azuread.NamedLocation

Explore with Pulumi AI

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azuread from "@pulumi/azuread";

const example_ip = new azuread.NamedLocation("example-ip", {
    displayName: "IP Named Location",
    ip: {
        ipRanges: [
            "1.1.1.1/32",
            "2.2.2.2/32",
        ],
        trusted: true,
    },
});
const example_country = new azuread.NamedLocation("example-country", {
    displayName: "Country Named Location",
    country: {
        countriesAndRegions: [
            "GB",
            "US",
        ],
        includeUnknownCountriesAndRegions: false,
    },
});
Copy
import pulumi
import pulumi_azuread as azuread

example_ip = azuread.NamedLocation("example-ip",
    display_name="IP Named Location",
    ip={
        "ip_ranges": [
            "1.1.1.1/32",
            "2.2.2.2/32",
        ],
        "trusted": True,
    })
example_country = azuread.NamedLocation("example-country",
    display_name="Country Named Location",
    country={
        "countries_and_regions": [
            "GB",
            "US",
        ],
        "include_unknown_countries_and_regions": False,
    })
Copy
package main

import (
	"github.com/pulumi/pulumi-azuread/sdk/v6/go/azuread"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := azuread.NewNamedLocation(ctx, "example-ip", &azuread.NamedLocationArgs{
			DisplayName: pulumi.String("IP Named Location"),
			Ip: &azuread.NamedLocationIpArgs{
				IpRanges: pulumi.StringArray{
					pulumi.String("1.1.1.1/32"),
					pulumi.String("2.2.2.2/32"),
				},
				Trusted: pulumi.Bool(true),
			},
		})
		if err != nil {
			return err
		}
		_, err = azuread.NewNamedLocation(ctx, "example-country", &azuread.NamedLocationArgs{
			DisplayName: pulumi.String("Country Named Location"),
			Country: &azuread.NamedLocationCountryArgs{
				CountriesAndRegions: pulumi.StringArray{
					pulumi.String("GB"),
					pulumi.String("US"),
				},
				IncludeUnknownCountriesAndRegions: pulumi.Bool(false),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureAD = Pulumi.AzureAD;

return await Deployment.RunAsync(() => 
{
    var example_ip = new AzureAD.NamedLocation("example-ip", new()
    {
        DisplayName = "IP Named Location",
        Ip = new AzureAD.Inputs.NamedLocationIpArgs
        {
            IpRanges = new[]
            {
                "1.1.1.1/32",
                "2.2.2.2/32",
            },
            Trusted = true,
        },
    });

    var example_country = new AzureAD.NamedLocation("example-country", new()
    {
        DisplayName = "Country Named Location",
        Country = new AzureAD.Inputs.NamedLocationCountryArgs
        {
            CountriesAndRegions = new[]
            {
                "GB",
                "US",
            },
            IncludeUnknownCountriesAndRegions = false,
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azuread.NamedLocation;
import com.pulumi.azuread.NamedLocationArgs;
import com.pulumi.azuread.inputs.NamedLocationIpArgs;
import com.pulumi.azuread.inputs.NamedLocationCountryArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example_ip = new NamedLocation("example-ip", NamedLocationArgs.builder()
            .displayName("IP Named Location")
            .ip(NamedLocationIpArgs.builder()
                .ipRanges(                
                    "1.1.1.1/32",
                    "2.2.2.2/32")
                .trusted(true)
                .build())
            .build());

        var example_country = new NamedLocation("example-country", NamedLocationArgs.builder()
            .displayName("Country Named Location")
            .country(NamedLocationCountryArgs.builder()
                .countriesAndRegions(                
                    "GB",
                    "US")
                .includeUnknownCountriesAndRegions(false)
                .build())
            .build());

    }
}
Copy
resources:
  example-ip:
    type: azuread:NamedLocation
    properties:
      displayName: IP Named Location
      ip:
        ipRanges:
          - 1.1.1.1/32
          - 2.2.2.2/32
        trusted: true
  example-country:
    type: azuread:NamedLocation
    properties:
      displayName: Country Named Location
      country:
        countriesAndRegions:
          - GB
          - US
        includeUnknownCountriesAndRegions: false
Copy

Create NamedLocation Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new NamedLocation(name: string, args: NamedLocationArgs, opts?: CustomResourceOptions);
@overload
def NamedLocation(resource_name: str,
                  args: NamedLocationArgs,
                  opts: Optional[ResourceOptions] = None)

@overload
def NamedLocation(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  display_name: Optional[str] = None,
                  country: Optional[NamedLocationCountryArgs] = None,
                  ip: Optional[NamedLocationIpArgs] = None)
func NewNamedLocation(ctx *Context, name string, args NamedLocationArgs, opts ...ResourceOption) (*NamedLocation, error)
public NamedLocation(string name, NamedLocationArgs args, CustomResourceOptions? opts = null)
public NamedLocation(String name, NamedLocationArgs args)
public NamedLocation(String name, NamedLocationArgs args, CustomResourceOptions options)
type: azuread:NamedLocation
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. NamedLocationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. NamedLocationArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. NamedLocationArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. NamedLocationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. NamedLocationArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var namedLocationResource = new AzureAD.NamedLocation("namedLocationResource", new()
{
    DisplayName = "string",
    Country = new AzureAD.Inputs.NamedLocationCountryArgs
    {
        CountriesAndRegions = new[]
        {
            "string",
        },
        CountryLookupMethod = "string",
        IncludeUnknownCountriesAndRegions = false,
    },
    Ip = new AzureAD.Inputs.NamedLocationIpArgs
    {
        IpRanges = new[]
        {
            "string",
        },
        Trusted = false,
    },
});
Copy
example, err := azuread.NewNamedLocation(ctx, "namedLocationResource", &azuread.NamedLocationArgs{
	DisplayName: pulumi.String("string"),
	Country: &azuread.NamedLocationCountryArgs{
		CountriesAndRegions: pulumi.StringArray{
			pulumi.String("string"),
		},
		CountryLookupMethod:               pulumi.String("string"),
		IncludeUnknownCountriesAndRegions: pulumi.Bool(false),
	},
	Ip: &azuread.NamedLocationIpArgs{
		IpRanges: pulumi.StringArray{
			pulumi.String("string"),
		},
		Trusted: pulumi.Bool(false),
	},
})
Copy
var namedLocationResource = new NamedLocation("namedLocationResource", NamedLocationArgs.builder()
    .displayName("string")
    .country(NamedLocationCountryArgs.builder()
        .countriesAndRegions("string")
        .countryLookupMethod("string")
        .includeUnknownCountriesAndRegions(false)
        .build())
    .ip(NamedLocationIpArgs.builder()
        .ipRanges("string")
        .trusted(false)
        .build())
    .build());
Copy
named_location_resource = azuread.NamedLocation("namedLocationResource",
    display_name="string",
    country={
        "countries_and_regions": ["string"],
        "country_lookup_method": "string",
        "include_unknown_countries_and_regions": False,
    },
    ip={
        "ip_ranges": ["string"],
        "trusted": False,
    })
Copy
const namedLocationResource = new azuread.NamedLocation("namedLocationResource", {
    displayName: "string",
    country: {
        countriesAndRegions: ["string"],
        countryLookupMethod: "string",
        includeUnknownCountriesAndRegions: false,
    },
    ip: {
        ipRanges: ["string"],
        trusted: false,
    },
});
Copy
type: azuread:NamedLocation
properties:
    country:
        countriesAndRegions:
            - string
        countryLookupMethod: string
        includeUnknownCountriesAndRegions: false
    displayName: string
    ip:
        ipRanges:
            - string
        trusted: false
Copy

NamedLocation Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The NamedLocation resource accepts the following input properties:

DisplayName This property is required. string
The friendly name for this named location.
Country Changes to this property will trigger replacement. Pulumi.AzureAD.Inputs.NamedLocationCountry
A country block as documented below, which configures a country-based named location.
Ip Changes to this property will trigger replacement. Pulumi.AzureAD.Inputs.NamedLocationIp

An ip block as documented below, which configures an IP-based named location.

Exactly one of ip or country must be specified. Changing between these forces a new resource to be created.

DisplayName This property is required. string
The friendly name for this named location.
Country Changes to this property will trigger replacement. NamedLocationCountryArgs
A country block as documented below, which configures a country-based named location.
Ip Changes to this property will trigger replacement. NamedLocationIpArgs

An ip block as documented below, which configures an IP-based named location.

Exactly one of ip or country must be specified. Changing between these forces a new resource to be created.

displayName This property is required. String
The friendly name for this named location.
country Changes to this property will trigger replacement. NamedLocationCountry
A country block as documented below, which configures a country-based named location.
ip Changes to this property will trigger replacement. NamedLocationIp

An ip block as documented below, which configures an IP-based named location.

Exactly one of ip or country must be specified. Changing between these forces a new resource to be created.

displayName This property is required. string
The friendly name for this named location.
country Changes to this property will trigger replacement. NamedLocationCountry
A country block as documented below, which configures a country-based named location.
ip Changes to this property will trigger replacement. NamedLocationIp

An ip block as documented below, which configures an IP-based named location.

Exactly one of ip or country must be specified. Changing between these forces a new resource to be created.

display_name This property is required. str
The friendly name for this named location.
country Changes to this property will trigger replacement. NamedLocationCountryArgs
A country block as documented below, which configures a country-based named location.
ip Changes to this property will trigger replacement. NamedLocationIpArgs

An ip block as documented below, which configures an IP-based named location.

Exactly one of ip or country must be specified. Changing between these forces a new resource to be created.

displayName This property is required. String
The friendly name for this named location.
country Changes to this property will trigger replacement. Property Map
A country block as documented below, which configures a country-based named location.
ip Changes to this property will trigger replacement. Property Map

An ip block as documented below, which configures an IP-based named location.

Exactly one of ip or country must be specified. Changing between these forces a new resource to be created.

Outputs

All input properties are implicitly available as output properties. Additionally, the NamedLocation resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing NamedLocation Resource

Get an existing NamedLocation resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: NamedLocationState, opts?: CustomResourceOptions): NamedLocation
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        country: Optional[NamedLocationCountryArgs] = None,
        display_name: Optional[str] = None,
        ip: Optional[NamedLocationIpArgs] = None) -> NamedLocation
func GetNamedLocation(ctx *Context, name string, id IDInput, state *NamedLocationState, opts ...ResourceOption) (*NamedLocation, error)
public static NamedLocation Get(string name, Input<string> id, NamedLocationState? state, CustomResourceOptions? opts = null)
public static NamedLocation get(String name, Output<String> id, NamedLocationState state, CustomResourceOptions options)
resources:  _:    type: azuread:NamedLocation    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Country Changes to this property will trigger replacement. Pulumi.AzureAD.Inputs.NamedLocationCountry
A country block as documented below, which configures a country-based named location.
DisplayName string
The friendly name for this named location.
Ip Changes to this property will trigger replacement. Pulumi.AzureAD.Inputs.NamedLocationIp

An ip block as documented below, which configures an IP-based named location.

Exactly one of ip or country must be specified. Changing between these forces a new resource to be created.

Country Changes to this property will trigger replacement. NamedLocationCountryArgs
A country block as documented below, which configures a country-based named location.
DisplayName string
The friendly name for this named location.
Ip Changes to this property will trigger replacement. NamedLocationIpArgs

An ip block as documented below, which configures an IP-based named location.

Exactly one of ip or country must be specified. Changing between these forces a new resource to be created.

country Changes to this property will trigger replacement. NamedLocationCountry
A country block as documented below, which configures a country-based named location.
displayName String
The friendly name for this named location.
ip Changes to this property will trigger replacement. NamedLocationIp

An ip block as documented below, which configures an IP-based named location.

Exactly one of ip or country must be specified. Changing between these forces a new resource to be created.

country Changes to this property will trigger replacement. NamedLocationCountry
A country block as documented below, which configures a country-based named location.
displayName string
The friendly name for this named location.
ip Changes to this property will trigger replacement. NamedLocationIp

An ip block as documented below, which configures an IP-based named location.

Exactly one of ip or country must be specified. Changing between these forces a new resource to be created.

country Changes to this property will trigger replacement. NamedLocationCountryArgs
A country block as documented below, which configures a country-based named location.
display_name str
The friendly name for this named location.
ip Changes to this property will trigger replacement. NamedLocationIpArgs

An ip block as documented below, which configures an IP-based named location.

Exactly one of ip or country must be specified. Changing between these forces a new resource to be created.

country Changes to this property will trigger replacement. Property Map
A country block as documented below, which configures a country-based named location.
displayName String
The friendly name for this named location.
ip Changes to this property will trigger replacement. Property Map

An ip block as documented below, which configures an IP-based named location.

Exactly one of ip or country must be specified. Changing between these forces a new resource to be created.

Supporting Types

NamedLocationCountry
, NamedLocationCountryArgs

CountriesAndRegions This property is required. List<string>
List of countries and/or regions in two-letter format specified by ISO 3166-2.
CountryLookupMethod string
Method of detecting country the user is located in. Possible values are clientIpAddress for IP-based location and authenticatorAppGps for Authenticator app GPS-based location. Defaults to clientIpAddress.
IncludeUnknownCountriesAndRegions bool
Whether IP addresses that don't map to a country or region should be included in the named location. Defaults to false.
CountriesAndRegions This property is required. []string
List of countries and/or regions in two-letter format specified by ISO 3166-2.
CountryLookupMethod string
Method of detecting country the user is located in. Possible values are clientIpAddress for IP-based location and authenticatorAppGps for Authenticator app GPS-based location. Defaults to clientIpAddress.
IncludeUnknownCountriesAndRegions bool
Whether IP addresses that don't map to a country or region should be included in the named location. Defaults to false.
countriesAndRegions This property is required. List<String>
List of countries and/or regions in two-letter format specified by ISO 3166-2.
countryLookupMethod String
Method of detecting country the user is located in. Possible values are clientIpAddress for IP-based location and authenticatorAppGps for Authenticator app GPS-based location. Defaults to clientIpAddress.
includeUnknownCountriesAndRegions Boolean
Whether IP addresses that don't map to a country or region should be included in the named location. Defaults to false.
countriesAndRegions This property is required. string[]
List of countries and/or regions in two-letter format specified by ISO 3166-2.
countryLookupMethod string
Method of detecting country the user is located in. Possible values are clientIpAddress for IP-based location and authenticatorAppGps for Authenticator app GPS-based location. Defaults to clientIpAddress.
includeUnknownCountriesAndRegions boolean
Whether IP addresses that don't map to a country or region should be included in the named location. Defaults to false.
countries_and_regions This property is required. Sequence[str]
List of countries and/or regions in two-letter format specified by ISO 3166-2.
country_lookup_method str
Method of detecting country the user is located in. Possible values are clientIpAddress for IP-based location and authenticatorAppGps for Authenticator app GPS-based location. Defaults to clientIpAddress.
include_unknown_countries_and_regions bool
Whether IP addresses that don't map to a country or region should be included in the named location. Defaults to false.
countriesAndRegions This property is required. List<String>
List of countries and/or regions in two-letter format specified by ISO 3166-2.
countryLookupMethod String
Method of detecting country the user is located in. Possible values are clientIpAddress for IP-based location and authenticatorAppGps for Authenticator app GPS-based location. Defaults to clientIpAddress.
includeUnknownCountriesAndRegions Boolean
Whether IP addresses that don't map to a country or region should be included in the named location. Defaults to false.

NamedLocationIp
, NamedLocationIpArgs

IpRanges This property is required. List<string>
List of IP address ranges in IPv4 CIDR format (e.g. 1.2.3.4/32) or any allowable IPv6 format from IETF RFC596. Each CIDR prefix must be /8 or larger.
Trusted bool
Whether the named location is trusted. Defaults to false.
IpRanges This property is required. []string
List of IP address ranges in IPv4 CIDR format (e.g. 1.2.3.4/32) or any allowable IPv6 format from IETF RFC596. Each CIDR prefix must be /8 or larger.
Trusted bool
Whether the named location is trusted. Defaults to false.
ipRanges This property is required. List<String>
List of IP address ranges in IPv4 CIDR format (e.g. 1.2.3.4/32) or any allowable IPv6 format from IETF RFC596. Each CIDR prefix must be /8 or larger.
trusted Boolean
Whether the named location is trusted. Defaults to false.
ipRanges This property is required. string[]
List of IP address ranges in IPv4 CIDR format (e.g. 1.2.3.4/32) or any allowable IPv6 format from IETF RFC596. Each CIDR prefix must be /8 or larger.
trusted boolean
Whether the named location is trusted. Defaults to false.
ip_ranges This property is required. Sequence[str]
List of IP address ranges in IPv4 CIDR format (e.g. 1.2.3.4/32) or any allowable IPv6 format from IETF RFC596. Each CIDR prefix must be /8 or larger.
trusted bool
Whether the named location is trusted. Defaults to false.
ipRanges This property is required. List<String>
List of IP address ranges in IPv4 CIDR format (e.g. 1.2.3.4/32) or any allowable IPv6 format from IETF RFC596. Each CIDR prefix must be /8 or larger.
trusted Boolean
Whether the named location is trusted. Defaults to false.

Import

Named Locations can be imported using the id, e.g.

$ pulumi import azuread:index/namedLocation:NamedLocation my_location /identity/conditionalAccess/namedLocations/00000000-0000-0000-0000-000000000000
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Azure Active Directory (Azure AD) pulumi/pulumi-azuread
License
Apache-2.0
Notes
This Pulumi package is based on the azuread Terraform Provider.