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

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

azure.dns.getARecord

Explore with Pulumi AI

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

Example Usage

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

const example = azure.dns.getARecord({
    name: "test",
    zoneName: "test-zone",
    resourceGroupName: "test-rg",
});
export const dnsARecordId = example.then(example => example.id);
Copy
import pulumi
import pulumi_azure as azure

example = azure.dns.get_a_record(name="test",
    zone_name="test-zone",
    resource_group_name="test-rg")
pulumi.export("dnsARecordId", example.id)
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := dns.LookupARecord(ctx, &dns.LookupARecordArgs{
			Name:              "test",
			ZoneName:          "test-zone",
			ResourceGroupName: "test-rg",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("dnsARecordId", example.Id)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var example = Azure.Dns.GetARecord.Invoke(new()
    {
        Name = "test",
        ZoneName = "test-zone",
        ResourceGroupName = "test-rg",
    });

    return new Dictionary<string, object?>
    {
        ["dnsARecordId"] = example.Apply(getARecordResult => getARecordResult.Id),
    };
});
Copy
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.GetARecordArgs;
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.getARecord(GetARecordArgs.builder()
            .name("test")
            .zoneName("test-zone")
            .resourceGroupName("test-rg")
            .build());

        ctx.export("dnsARecordId", example.applyValue(getARecordResult -> getARecordResult.id()));
    }
}
Copy
variables:
  example:
    fn::invoke:
      function: azure:dns:getARecord
      arguments:
        name: test
        zoneName: test-zone
        resourceGroupName: test-rg
outputs:
  dnsARecordId: ${example.id}
Copy

Using getARecord

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 getARecord(args: GetARecordArgs, opts?: InvokeOptions): Promise<GetARecordResult>
function getARecordOutput(args: GetARecordOutputArgs, opts?: InvokeOptions): Output<GetARecordResult>
Copy
def get_a_record(name: Optional[str] = None,
                 resource_group_name: Optional[str] = None,
                 zone_name: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetARecordResult
def get_a_record_output(name: Optional[pulumi.Input[str]] = None,
                 resource_group_name: Optional[pulumi.Input[str]] = None,
                 zone_name: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetARecordResult]
Copy
func LookupARecord(ctx *Context, args *LookupARecordArgs, opts ...InvokeOption) (*LookupARecordResult, error)
func LookupARecordOutput(ctx *Context, args *LookupARecordOutputArgs, opts ...InvokeOption) LookupARecordResultOutput
Copy

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

public static class GetARecord 
{
    public static Task<GetARecordResult> InvokeAsync(GetARecordArgs args, InvokeOptions? opts = null)
    public static Output<GetARecordResult> Invoke(GetARecordInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetARecordResult> getARecord(GetARecordArgs args, InvokeOptions options)
public static Output<GetARecordResult> getARecord(GetARecordArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: azure:dns/getARecord:getARecord
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name This property is required. string
The name of the DNS A Record.
ResourceGroupName This property is required. string
Specifies the resource group where the DNS Zone (parent resource) exists.
ZoneName This property is required. string
Specifies the DNS Zone where the resource exists.
Name This property is required. string
The name of the DNS A Record.
ResourceGroupName This property is required. string
Specifies the resource group where the DNS Zone (parent resource) exists.
ZoneName This property is required. string
Specifies the DNS Zone where the resource exists.
name This property is required. String
The name of the DNS A Record.
resourceGroupName This property is required. String
Specifies the resource group where the DNS Zone (parent resource) exists.
zoneName This property is required. String
Specifies the DNS Zone where the resource exists.
name This property is required. string
The name of the DNS A Record.
resourceGroupName This property is required. string
Specifies the resource group where the DNS Zone (parent resource) exists.
zoneName This property is required. string
Specifies the DNS Zone where the resource exists.
name This property is required. str
The name of the DNS A Record.
resource_group_name This property is required. str
Specifies the resource group where the DNS Zone (parent resource) exists.
zone_name This property is required. str
Specifies the DNS Zone where the resource exists.
name This property is required. String
The name of the DNS A Record.
resourceGroupName This property is required. String
Specifies the resource group where the DNS Zone (parent resource) exists.
zoneName This property is required. String
Specifies the DNS Zone where the resource exists.

getARecord Result

The following output properties are available:

Fqdn string
The FQDN of the DNS A Record.
Id string
The provider-assigned unique ID for this managed resource.
Name string
Records List<string>
List of IPv4 Addresses.
ResourceGroupName string
Tags Dictionary<string, string>
A mapping of tags assigned to the DNS A Record.
TargetResourceId string
The Azure resource id of the target object from where the dns resource value is taken.
Ttl int
The Time To Live (TTL) of the DNS record in seconds.
ZoneName string
Fqdn string
The FQDN of the DNS A Record.
Id string
The provider-assigned unique ID for this managed resource.
Name string
Records []string
List of IPv4 Addresses.
ResourceGroupName string
Tags map[string]string
A mapping of tags assigned to the DNS A Record.
TargetResourceId string
The Azure resource id of the target object from where the dns resource value is taken.
Ttl int
The Time To Live (TTL) of the DNS record in seconds.
ZoneName string
fqdn String
The FQDN of the DNS A Record.
id String
The provider-assigned unique ID for this managed resource.
name String
records List<String>
List of IPv4 Addresses.
resourceGroupName String
tags Map<String,String>
A mapping of tags assigned to the DNS A Record.
targetResourceId String
The Azure resource id of the target object from where the dns resource value is taken.
ttl Integer
The Time To Live (TTL) of the DNS record in seconds.
zoneName String
fqdn string
The FQDN of the DNS A Record.
id string
The provider-assigned unique ID for this managed resource.
name string
records string[]
List of IPv4 Addresses.
resourceGroupName string
tags {[key: string]: string}
A mapping of tags assigned to the DNS A Record.
targetResourceId string
The Azure resource id of the target object from where the dns resource value is taken.
ttl number
The Time To Live (TTL) of the DNS record in seconds.
zoneName string
fqdn str
The FQDN of the DNS A Record.
id str
The provider-assigned unique ID for this managed resource.
name str
records Sequence[str]
List of IPv4 Addresses.
resource_group_name str
tags Mapping[str, str]
A mapping of tags assigned to the DNS A Record.
target_resource_id str
The Azure resource id of the target object from where the dns resource value is taken.
ttl int
The Time To Live (TTL) of the DNS record in seconds.
zone_name str
fqdn String
The FQDN of the DNS A Record.
id String
The provider-assigned unique ID for this managed resource.
name String
records List<String>
List of IPv4 Addresses.
resourceGroupName String
tags Map<String>
A mapping of tags assigned to the DNS A Record.
targetResourceId String
The Azure resource id of the target object from where the dns resource value is taken.
ttl Number
The Time To Live (TTL) of the DNS record in seconds.
zoneName String

Package Details

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

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi