1. Packages
  2. Azure Active Directory (Azure AD)
  3. API Docs
  4. NamedLocation
Azure Active Directory (Azure AD) v5.48.0 published on Monday, Apr 15, 2024 by Pulumi

azuread.NamedLocation

Explore with Pulumi AI

azuread logo
Azure Active Directory (Azure AD) v5.48.0 published on Monday, Apr 15, 2024 by Pulumi

    Manages a Named Location within Azure Active Directory.

    API Permissions

    The following API permissions are required in order to use this resource.

    When authenticated with a service principal, this resource requires the following application roles: Policy.ReadWrite.ConditionalAccess and Policy.Read.All

    When authenticated with a user principal, this resource requires one of the following directory roles: Conditional Access Administrator or Global Administrator

    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,
        },
    });
    
    import pulumi
    import pulumi_azuread as azuread
    
    example_ip = azuread.NamedLocation("example-ip",
        display_name="IP Named Location",
        ip=azuread.NamedLocationIpArgs(
            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=azuread.NamedLocationCountryArgs(
            countries_and_regions=[
                "GB",
                "US",
            ],
            include_unknown_countries_and_regions=False,
        ))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azuread/sdk/v5/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
    	})
    }
    
    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,
            },
        });
    
    });
    
    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());
    
        }
    }
    
    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
    

    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 string
    The unique name of the resource.
    args NamedLocationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args 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 string
    The unique name of the resource.
    args NamedLocationArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args NamedLocationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args NamedLocationArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    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

    The NamedLocation resource accepts the following input properties:

    DisplayName string
    The friendly name for this named location.
    Country Pulumi.AzureAD.Inputs.NamedLocationCountry
    A country block as documented below, which configures a country-based named location.
    Ip 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 string
    The friendly name for this named location.
    Country NamedLocationCountryArgs
    A country block as documented below, which configures a country-based named location.
    Ip 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 String
    The friendly name for this named location.
    country NamedLocationCountry
    A country block as documented below, which configures a country-based named location.
    ip 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 string
    The friendly name for this named location.
    country NamedLocationCountry
    A country block as documented below, which configures a country-based named location.
    ip 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 str
    The friendly name for this named location.
    country NamedLocationCountryArgs
    A country block as documented below, which configures a country-based named location.
    ip 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 String
    The friendly name for this named location.
    country Property Map
    A country block as documented below, which configures a country-based named location.
    ip 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)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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 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 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 NamedLocationCountryArgs
    A country block as documented below, which configures a country-based named location.
    DisplayName string
    The friendly name for this named location.
    Ip 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 NamedLocationCountry
    A country block as documented below, which configures a country-based named location.
    displayName String
    The friendly name for this named location.
    ip 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 NamedLocationCountry
    A country block as documented below, which configures a country-based named location.
    displayName string
    The friendly name for this named location.
    ip 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 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 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 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 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 List<string>
    List of countries and/or regions in two-letter format specified by ISO 3166-2.
    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 []string
    List of countries and/or regions in two-letter format specified by ISO 3166-2.
    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 List<String>
    List of countries and/or regions in two-letter format specified by ISO 3166-2.
    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 string[]
    List of countries and/or regions in two-letter format specified by ISO 3166-2.
    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 Sequence[str]
    List of countries and/or regions in two-letter format specified by ISO 3166-2.
    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 List<String>
    List of countries and/or regions in two-letter format specified by ISO 3166-2.
    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 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 []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 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 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 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 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 00000000-0000-0000-0000-000000000000
    

    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.
    azuread logo
    Azure Active Directory (Azure AD) v5.48.0 published on Monday, Apr 15, 2024 by Pulumi