1. Packages
  2. Azure Classic
  3. API Docs
  4. dns
  5. getZone

We recommend using Azure Native.

Azure Classic v5.83.0 published on Monday, Jul 8, 2024 by Pulumi

azure.dns.getZone

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.83.0 published on Monday, Jul 8, 2024 by Pulumi

    Use this data source to access information about an existing DNS Zone.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const example = azure.dns.getZone({
        name: "search-eventhubns",
        resourceGroupName: "search-service",
    });
    export const dnsZoneId = example.then(example => example.id);
    
    import pulumi
    import pulumi_azure as azure
    
    example = azure.dns.get_zone(name="search-eventhubns",
        resource_group_name="search-service")
    pulumi.export("dnsZoneId", example.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/dns"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := dns.LookupZone(ctx, &dns.LookupZoneArgs{
    			Name:              "search-eventhubns",
    			ResourceGroupName: pulumi.StringRef("search-service"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("dnsZoneId", example.Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Azure.Dns.GetZone.Invoke(new()
        {
            Name = "search-eventhubns",
            ResourceGroupName = "search-service",
        });
    
        return new Dictionary<string, object?>
        {
            ["dnsZoneId"] = example.Apply(getZoneResult => getZoneResult.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azure.dns.DnsFunctions;
    import com.pulumi.azure.dns.inputs.GetZoneArgs;
    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) {
            final var example = DnsFunctions.getZone(GetZoneArgs.builder()
                .name("search-eventhubns")
                .resourceGroupName("search-service")
                .build());
    
            ctx.export("dnsZoneId", example.applyValue(getZoneResult -> getZoneResult.id()));
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: azure:dns:getZone
          Arguments:
            name: search-eventhubns
            resourceGroupName: search-service
    outputs:
      dnsZoneId: ${example.id}
    

    Using getZone

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getZone(args: GetZoneArgs, opts?: InvokeOptions): Promise<GetZoneResult>
    function getZoneOutput(args: GetZoneOutputArgs, opts?: InvokeOptions): Output<GetZoneResult>
    def get_zone(name: Optional[str] = None,
                 resource_group_name: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetZoneResult
    def get_zone_output(name: Optional[pulumi.Input[str]] = None,
                 resource_group_name: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetZoneResult]
    func LookupZone(ctx *Context, args *LookupZoneArgs, opts ...InvokeOption) (*LookupZoneResult, error)
    func LookupZoneOutput(ctx *Context, args *LookupZoneOutputArgs, opts ...InvokeOption) LookupZoneResultOutput

    > Note: This function is named LookupZone in the Go SDK.

    public static class GetZone 
    {
        public static Task<GetZoneResult> InvokeAsync(GetZoneArgs args, InvokeOptions? opts = null)
        public static Output<GetZoneResult> Invoke(GetZoneInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetZoneResult> getZone(GetZoneArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: azure:dns/getZone:getZone
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    The name of the DNS Zone.
    ResourceGroupName string
    The Name of the Resource Group where the DNS Zone exists. If the Name of the Resource Group is not provided, the first DNS Zone from the list of DNS Zones in your subscription that matches name will be returned.
    Name string
    The name of the DNS Zone.
    ResourceGroupName string
    The Name of the Resource Group where the DNS Zone exists. If the Name of the Resource Group is not provided, the first DNS Zone from the list of DNS Zones in your subscription that matches name will be returned.
    name String
    The name of the DNS Zone.
    resourceGroupName String
    The Name of the Resource Group where the DNS Zone exists. If the Name of the Resource Group is not provided, the first DNS Zone from the list of DNS Zones in your subscription that matches name will be returned.
    name string
    The name of the DNS Zone.
    resourceGroupName string
    The Name of the Resource Group where the DNS Zone exists. If the Name of the Resource Group is not provided, the first DNS Zone from the list of DNS Zones in your subscription that matches name will be returned.
    name str
    The name of the DNS Zone.
    resource_group_name str
    The Name of the Resource Group where the DNS Zone exists. If the Name of the Resource Group is not provided, the first DNS Zone from the list of DNS Zones in your subscription that matches name will be returned.
    name String
    The name of the DNS Zone.
    resourceGroupName String
    The Name of the Resource Group where the DNS Zone exists. If the Name of the Resource Group is not provided, the first DNS Zone from the list of DNS Zones in your subscription that matches name will be returned.

    getZone Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    MaxNumberOfRecordSets int
    Maximum number of Records in the zone.
    Name string
    NameServers List<string>
    A list of values that make up the NS record for the zone.
    NumberOfRecordSets int
    The number of records already in the zone.
    ResourceGroupName string
    Tags Dictionary<string, string>
    A mapping of tags assigned to the DNS Zone.
    Id string
    The provider-assigned unique ID for this managed resource.
    MaxNumberOfRecordSets int
    Maximum number of Records in the zone.
    Name string
    NameServers []string
    A list of values that make up the NS record for the zone.
    NumberOfRecordSets int
    The number of records already in the zone.
    ResourceGroupName string
    Tags map[string]string
    A mapping of tags assigned to the DNS Zone.
    id String
    The provider-assigned unique ID for this managed resource.
    maxNumberOfRecordSets Integer
    Maximum number of Records in the zone.
    name String
    nameServers List<String>
    A list of values that make up the NS record for the zone.
    numberOfRecordSets Integer
    The number of records already in the zone.
    resourceGroupName String
    tags Map<String,String>
    A mapping of tags assigned to the DNS Zone.
    id string
    The provider-assigned unique ID for this managed resource.
    maxNumberOfRecordSets number
    Maximum number of Records in the zone.
    name string
    nameServers string[]
    A list of values that make up the NS record for the zone.
    numberOfRecordSets number
    The number of records already in the zone.
    resourceGroupName string
    tags {[key: string]: string}
    A mapping of tags assigned to the DNS Zone.
    id str
    The provider-assigned unique ID for this managed resource.
    max_number_of_record_sets int
    Maximum number of Records in the zone.
    name str
    name_servers Sequence[str]
    A list of values that make up the NS record for the zone.
    number_of_record_sets int
    The number of records already in the zone.
    resource_group_name str
    tags Mapping[str, str]
    A mapping of tags assigned to the DNS Zone.
    id String
    The provider-assigned unique ID for this managed resource.
    maxNumberOfRecordSets Number
    Maximum number of Records in the zone.
    name String
    nameServers List<String>
    A list of values that make up the NS record for the zone.
    numberOfRecordSets Number
    The number of records already in the zone.
    resourceGroupName String
    tags Map<String>
    A mapping of tags assigned to the DNS Zone.

    Package Details

    Repository
    Azure Classic pulumi/pulumi-azure
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Azure Classic v5.83.0 published on Monday, Jul 8, 2024 by Pulumi