获取记录集。
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}?api-version=2018-05-01
URI 参数
名称 |
在 |
必需 |
类型 |
说明 |
recordType
|
path |
True
|
RecordType
|
此记录集中的 DNS 记录的类型。
|
relativeRecordSetName
|
path |
True
|
string
|
相对于区域名称的记录集的名称。
|
resourceGroupName
|
path |
True
|
string
|
资源组的名称。
|
subscriptionId
|
path |
True
|
string
|
指定唯一标识 Microsoft Azure 订阅的 Azure 订阅 ID。
|
zoneName
|
path |
True
|
string
|
DNS 区域的名称 (没有终止点) 。
|
api-version
|
query |
True
|
string
|
指定 API 版本。
|
响应
示例
Get A recordset
Sample Request
GET https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/A/record1?api-version=2018-05-01
import com.azure.resourcemanager.dns.models.RecordType;
/** Samples for RecordSets Get. */
public final class Main {
/*
* x-ms-original-file:
* specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetARecordset.json
*/
/**
* Sample code: Get A recordset.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getARecordset(com.azure.resourcemanager.AzureResourceManager azure) {
azure.dnsZones().manager().serviceClient().getRecordSets().getWithResponse("rg1", "zone1", "record1",
RecordType.A, com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.dns import DnsManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-dns
# USAGE
python get_arecordset.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = DnsManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.record_sets.get(
resource_group_name="rg1",
zone_name="zone1",
relative_record_set_name="record1",
record_type="A",
)
print(response)
# x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetARecordset.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armdns_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetARecordset.json
func ExampleRecordSetsClient_Get_getARecordset() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armdns.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewRecordSetsClient().Get(ctx, "rg1", "zone1", "record1", armdns.RecordTypeA, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.RecordSet = armdns.RecordSet{
// Name: to.Ptr("record1"),
// Type: to.Ptr("Microsoft.Network/dnsZones/A"),
// Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/A/record1"),
// Properties: &armdns.RecordSetProperties{
// ARecords: []*armdns.ARecord{
// {
// IPv4Address: to.Ptr("127.0.0.1"),
// }},
// TTL: to.Ptr[int64](3600),
// Fqdn: to.Ptr("record1.zone1"),
// Metadata: map[string]*string{
// "key1": to.Ptr("value1"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { DnsManagementClient } = require("@azure/arm-dns");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets a record set.
*
* @summary Gets a record set.
* x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetARecordset.json
*/
async function getARecordset() {
const subscriptionId = "subid";
const resourceGroupName = "rg1";
const zoneName = "zone1";
const relativeRecordSetName = "record1";
const recordType = "A";
const credential = new DefaultAzureCredential();
const client = new DnsManagementClient(credential, subscriptionId);
const result = await client.recordSets.get(
resourceGroupName,
zoneName,
relativeRecordSetName,
recordType
);
console.log(result);
}
getARecordset().catch(console.error);
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/A/record1",
"etag": "00000000-0000-0000-0000-000000000000",
"name": "record1",
"type": "Microsoft.Network/dnsZones/A",
"properties": {
"metadata": {
"key1": "value1"
},
"TTL": 3600,
"fqdn": "record1.zone1",
"ARecords": [
{
"ipv4Address": "127.0.0.1"
}
]
}
}
Get AAAA recordset
Sample Request
GET https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/AAAA/record1?api-version=2018-05-01
import com.azure.resourcemanager.dns.models.RecordType;
/** Samples for RecordSets Get. */
public final class Main {
/*
* x-ms-original-file:
* specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetAAAARecordset.json
*/
/**
* Sample code: Get AAAA recordset.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getAAAARecordset(com.azure.resourcemanager.AzureResourceManager azure) {
azure.dnsZones().manager().serviceClient().getRecordSets().getWithResponse("rg1", "zone1", "record1",
RecordType.AAAA, com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.dns import DnsManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-dns
# USAGE
python get_aaaa_recordset.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = DnsManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.record_sets.get(
resource_group_name="rg1",
zone_name="zone1",
relative_record_set_name="record1",
record_type="AAAA",
)
print(response)
# x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetAAAARecordset.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armdns_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetAAAARecordset.json
func ExampleRecordSetsClient_Get_getAaaaRecordset() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armdns.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewRecordSetsClient().Get(ctx, "rg1", "zone1", "record1", armdns.RecordTypeAAAA, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.RecordSet = armdns.RecordSet{
// Name: to.Ptr("record1"),
// Type: to.Ptr("Microsoft.Network/dnsZones/AAAA"),
// Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/AAAA/record1"),
// Properties: &armdns.RecordSetProperties{
// AaaaRecords: []*armdns.AaaaRecord{
// {
// IPv6Address: to.Ptr("::1"),
// }},
// TTL: to.Ptr[int64](3600),
// Fqdn: to.Ptr("record1.zone1"),
// Metadata: map[string]*string{
// "key1": to.Ptr("value1"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { DnsManagementClient } = require("@azure/arm-dns");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets a record set.
*
* @summary Gets a record set.
* x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetAAAARecordset.json
*/
async function getAaaaRecordset() {
const subscriptionId = "subid";
const resourceGroupName = "rg1";
const zoneName = "zone1";
const relativeRecordSetName = "record1";
const recordType = "AAAA";
const credential = new DefaultAzureCredential();
const client = new DnsManagementClient(credential, subscriptionId);
const result = await client.recordSets.get(
resourceGroupName,
zoneName,
relativeRecordSetName,
recordType
);
console.log(result);
}
getAaaaRecordset().catch(console.error);
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/AAAA/record1",
"etag": "00000000-0000-0000-0000-000000000000",
"name": "record1",
"type": "Microsoft.Network/dnsZones/AAAA",
"properties": {
"metadata": {
"key1": "value1"
},
"TTL": 3600,
"fqdn": "record1.zone1",
"AAAARecords": [
{
"ipv6Address": "::1"
}
]
}
}
Get CAA recordset
Sample Request
GET https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/CAA/record1?api-version=2018-05-01
import com.azure.resourcemanager.dns.models.RecordType;
/** Samples for RecordSets Get. */
public final class Main {
/*
* x-ms-original-file:
* specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetCaaRecordset.json
*/
/**
* Sample code: Get CAA recordset.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getCAARecordset(com.azure.resourcemanager.AzureResourceManager azure) {
azure.dnsZones().manager().serviceClient().getRecordSets().getWithResponse("rg1", "zone1", "record1",
RecordType.CAA, com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.dns import DnsManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-dns
# USAGE
python get_caa_recordset.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = DnsManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.record_sets.get(
resource_group_name="rg1",
zone_name="zone1",
relative_record_set_name="record1",
record_type="CAA",
)
print(response)
# x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetCaaRecordset.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armdns_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetCaaRecordset.json
func ExampleRecordSetsClient_Get_getCaaRecordset() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armdns.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewRecordSetsClient().Get(ctx, "rg1", "zone1", "record1", armdns.RecordTypeCAA, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.RecordSet = armdns.RecordSet{
// Name: to.Ptr("record1"),
// Type: to.Ptr("Microsoft.Network/dnsZones/CAA"),
// Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/CAA/record1"),
// Properties: &armdns.RecordSetProperties{
// TTL: to.Ptr[int64](3600),
// CaaRecords: []*armdns.CaaRecord{
// {
// Flags: to.Ptr[int32](0),
// Tag: to.Ptr("issue"),
// Value: to.Ptr("ca.contoso.com"),
// }},
// Fqdn: to.Ptr("record1.zone1"),
// Metadata: map[string]*string{
// "key1": to.Ptr("value1"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { DnsManagementClient } = require("@azure/arm-dns");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets a record set.
*
* @summary Gets a record set.
* x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetCaaRecordset.json
*/
async function getCaaRecordset() {
const subscriptionId = "subid";
const resourceGroupName = "rg1";
const zoneName = "zone1";
const relativeRecordSetName = "record1";
const recordType = "CAA";
const credential = new DefaultAzureCredential();
const client = new DnsManagementClient(credential, subscriptionId);
const result = await client.recordSets.get(
resourceGroupName,
zoneName,
relativeRecordSetName,
recordType
);
console.log(result);
}
getCaaRecordset().catch(console.error);
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/CAA/record1",
"etag": "00000000-0000-0000-0000-000000000000",
"name": "record1",
"type": "Microsoft.Network/dnsZones/CAA",
"properties": {
"metadata": {
"key1": "value1"
},
"TTL": 3600,
"fqdn": "record1.zone1",
"caaRecords": [
{
"flags": 0,
"tag": "issue",
"value": "ca.contoso.com"
}
]
}
}
Get CNAME recordset
Sample Request
GET https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/CNAME/record1?api-version=2018-05-01
import com.azure.resourcemanager.dns.models.RecordType;
/** Samples for RecordSets Get. */
public final class Main {
/*
* x-ms-original-file:
* specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetCNAMERecordset.json
*/
/**
* Sample code: Get CNAME recordset.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getCNAMERecordset(com.azure.resourcemanager.AzureResourceManager azure) {
azure.dnsZones().manager().serviceClient().getRecordSets().getWithResponse("rg1", "zone1", "record1",
RecordType.CNAME, com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.dns import DnsManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-dns
# USAGE
python get_cname_recordset.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = DnsManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.record_sets.get(
resource_group_name="rg1",
zone_name="zone1",
relative_record_set_name="record1",
record_type="CNAME",
)
print(response)
# x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetCNAMERecordset.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armdns_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetCNAMERecordset.json
func ExampleRecordSetsClient_Get_getCnameRecordset() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armdns.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewRecordSetsClient().Get(ctx, "rg1", "zone1", "record1", armdns.RecordTypeCNAME, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.RecordSet = armdns.RecordSet{
// Name: to.Ptr("record1"),
// Type: to.Ptr("Microsoft.Network/dnsZones/CNAME"),
// Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/CNAME/record1"),
// Properties: &armdns.RecordSetProperties{
// CnameRecord: &armdns.CnameRecord{
// Cname: to.Ptr("contoso.com"),
// },
// TTL: to.Ptr[int64](3600),
// Fqdn: to.Ptr("record1.zone1"),
// Metadata: map[string]*string{
// "key1": to.Ptr("value1"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { DnsManagementClient } = require("@azure/arm-dns");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets a record set.
*
* @summary Gets a record set.
* x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetCNAMERecordset.json
*/
async function getCnameRecordset() {
const subscriptionId = "subid";
const resourceGroupName = "rg1";
const zoneName = "zone1";
const relativeRecordSetName = "record1";
const recordType = "CNAME";
const credential = new DefaultAzureCredential();
const client = new DnsManagementClient(credential, subscriptionId);
const result = await client.recordSets.get(
resourceGroupName,
zoneName,
relativeRecordSetName,
recordType
);
console.log(result);
}
getCnameRecordset().catch(console.error);
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/CNAME/record1",
"etag": "00000000-0000-0000-0000-000000000000",
"name": "record1",
"type": "Microsoft.Network/dnsZones/CNAME",
"properties": {
"metadata": {
"key1": "value1"
},
"TTL": 3600,
"fqdn": "record1.zone1",
"CNAMERecord": {
"cname": "contoso.com"
}
}
}
Get MX recordset
Sample Request
GET https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/MX/record1?api-version=2018-05-01
import com.azure.resourcemanager.dns.models.RecordType;
/** Samples for RecordSets Get. */
public final class Main {
/*
* x-ms-original-file:
* specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetMXRecordset.json
*/
/**
* Sample code: Get MX recordset.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getMXRecordset(com.azure.resourcemanager.AzureResourceManager azure) {
azure.dnsZones().manager().serviceClient().getRecordSets().getWithResponse("rg1", "zone1", "record1",
RecordType.MX, com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.dns import DnsManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-dns
# USAGE
python get_mx_recordset.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = DnsManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.record_sets.get(
resource_group_name="rg1",
zone_name="zone1",
relative_record_set_name="record1",
record_type="MX",
)
print(response)
# x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetMXRecordset.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armdns_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetMXRecordset.json
func ExampleRecordSetsClient_Get_getMxRecordset() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armdns.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewRecordSetsClient().Get(ctx, "rg1", "zone1", "record1", armdns.RecordTypeMX, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.RecordSet = armdns.RecordSet{
// Name: to.Ptr("record1"),
// Type: to.Ptr("Microsoft.Network/dnsZones/MX"),
// Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/MX/record1"),
// Properties: &armdns.RecordSetProperties{
// MxRecords: []*armdns.MxRecord{
// {
// Exchange: to.Ptr("mail.contoso.com"),
// Preference: to.Ptr[int32](0),
// }},
// TTL: to.Ptr[int64](3600),
// Fqdn: to.Ptr("record1.zone1"),
// Metadata: map[string]*string{
// "key1": to.Ptr("value1"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { DnsManagementClient } = require("@azure/arm-dns");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets a record set.
*
* @summary Gets a record set.
* x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetMXRecordset.json
*/
async function getMxRecordset() {
const subscriptionId = "subid";
const resourceGroupName = "rg1";
const zoneName = "zone1";
const relativeRecordSetName = "record1";
const recordType = "MX";
const credential = new DefaultAzureCredential();
const client = new DnsManagementClient(credential, subscriptionId);
const result = await client.recordSets.get(
resourceGroupName,
zoneName,
relativeRecordSetName,
recordType
);
console.log(result);
}
getMxRecordset().catch(console.error);
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/MX/record1",
"etag": "00000000-0000-0000-0000-000000000000",
"name": "record1",
"type": "Microsoft.Network/dnsZones/MX",
"properties": {
"metadata": {
"key1": "value1"
},
"TTL": 3600,
"fqdn": "record1.zone1",
"MXRecords": [
{
"preference": 0,
"exchange": "mail.contoso.com"
}
]
}
}
Get NS recordset
Sample Request
GET https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/NS/record1?api-version=2018-05-01
import com.azure.resourcemanager.dns.models.RecordType;
/** Samples for RecordSets Get. */
public final class Main {
/*
* x-ms-original-file:
* specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetNSRecordset.json
*/
/**
* Sample code: Get NS recordset.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getNSRecordset(com.azure.resourcemanager.AzureResourceManager azure) {
azure.dnsZones().manager().serviceClient().getRecordSets().getWithResponse("rg1", "zone1", "record1",
RecordType.NS, com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.dns import DnsManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-dns
# USAGE
python get_ns_recordset.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = DnsManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.record_sets.get(
resource_group_name="rg1",
zone_name="zone1",
relative_record_set_name="record1",
record_type="NS",
)
print(response)
# x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetNSRecordset.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armdns_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetNSRecordset.json
func ExampleRecordSetsClient_Get_getNsRecordset() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armdns.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewRecordSetsClient().Get(ctx, "rg1", "zone1", "record1", armdns.RecordTypeNS, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.RecordSet = armdns.RecordSet{
// Name: to.Ptr("record1"),
// Type: to.Ptr("Microsoft.Network/dnsZones/NS"),
// Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/NS/record1"),
// Properties: &armdns.RecordSetProperties{
// NsRecords: []*armdns.NsRecord{
// {
// Nsdname: to.Ptr("ns1.contoso.com"),
// }},
// TTL: to.Ptr[int64](3600),
// Fqdn: to.Ptr("record1.zone1"),
// Metadata: map[string]*string{
// "key1": to.Ptr("value1"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { DnsManagementClient } = require("@azure/arm-dns");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets a record set.
*
* @summary Gets a record set.
* x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetNSRecordset.json
*/
async function getNsRecordset() {
const subscriptionId = "subid";
const resourceGroupName = "rg1";
const zoneName = "zone1";
const relativeRecordSetName = "record1";
const recordType = "NS";
const credential = new DefaultAzureCredential();
const client = new DnsManagementClient(credential, subscriptionId);
const result = await client.recordSets.get(
resourceGroupName,
zoneName,
relativeRecordSetName,
recordType
);
console.log(result);
}
getNsRecordset().catch(console.error);
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/NS/record1",
"etag": "00000000-0000-0000-0000-000000000000",
"name": "record1",
"type": "Microsoft.Network/dnsZones/NS",
"properties": {
"metadata": {
"key1": "value1"
},
"TTL": 3600,
"fqdn": "record1.zone1",
"NSRecords": [
{
"nsdname": "ns1.contoso.com"
}
]
}
}
Get PTR recordset
Sample Request
GET https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/0.0.127.in-addr.arpa/PTR/1?api-version=2018-05-01
import com.azure.resourcemanager.dns.models.RecordType;
/** Samples for RecordSets Get. */
public final class Main {
/*
* x-ms-original-file:
* specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetPTRRecordset.json
*/
/**
* Sample code: Get PTR recordset.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getPTRRecordset(com.azure.resourcemanager.AzureResourceManager azure) {
azure.dnsZones().manager().serviceClient().getRecordSets().getWithResponse("rg1", "0.0.127.in-addr.arpa", "1",
RecordType.PTR, com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.dns import DnsManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-dns
# USAGE
python get_ptr_recordset.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = DnsManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.record_sets.get(
resource_group_name="rg1",
zone_name="0.0.127.in-addr.arpa",
relative_record_set_name="1",
record_type="PTR",
)
print(response)
# x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetPTRRecordset.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armdns_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetPTRRecordset.json
func ExampleRecordSetsClient_Get_getPtrRecordset() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armdns.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewRecordSetsClient().Get(ctx, "rg1", "0.0.127.in-addr.arpa", "1", armdns.RecordTypePTR, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.RecordSet = armdns.RecordSet{
// Name: to.Ptr("1"),
// Type: to.Ptr("Microsoft.Network/dnsZones/PTR"),
// Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/0.0.127.in-addr.arpa/PTR/1"),
// Properties: &armdns.RecordSetProperties{
// PtrRecords: []*armdns.PtrRecord{
// {
// Ptrdname: to.Ptr("localhost"),
// }},
// TTL: to.Ptr[int64](3600),
// Fqdn: to.Ptr("1.0.0.127.in-addr.arpa"),
// Metadata: map[string]*string{
// "key1": to.Ptr("value1"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { DnsManagementClient } = require("@azure/arm-dns");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets a record set.
*
* @summary Gets a record set.
* x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetPTRRecordset.json
*/
async function getPtrRecordset() {
const subscriptionId = "subid";
const resourceGroupName = "rg1";
const zoneName = "0.0.127.in-addr.arpa";
const relativeRecordSetName = "1";
const recordType = "PTR";
const credential = new DefaultAzureCredential();
const client = new DnsManagementClient(credential, subscriptionId);
const result = await client.recordSets.get(
resourceGroupName,
zoneName,
relativeRecordSetName,
recordType
);
console.log(result);
}
getPtrRecordset().catch(console.error);
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/0.0.127.in-addr.arpa/PTR/1",
"etag": "00000000-0000-0000-0000-000000000000",
"name": "1",
"type": "Microsoft.Network/dnsZones/PTR",
"properties": {
"metadata": {
"key1": "value1"
},
"TTL": 3600,
"fqdn": "1.0.0.127.in-addr.arpa",
"PTRRecords": [
{
"ptrdname": "localhost"
}
]
}
}
Get SOA recordset
Sample Request
GET https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/SOA/@?api-version=2018-05-01
import com.azure.resourcemanager.dns.models.RecordType;
/** Samples for RecordSets Get. */
public final class Main {
/*
* x-ms-original-file:
* specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetSOARecordset.json
*/
/**
* Sample code: Get SOA recordset.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getSOARecordset(com.azure.resourcemanager.AzureResourceManager azure) {
azure.dnsZones().manager().serviceClient().getRecordSets().getWithResponse("rg1", "zone1", "@", RecordType.SOA,
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.dns import DnsManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-dns
# USAGE
python get_soa_recordset.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = DnsManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.record_sets.get(
resource_group_name="rg1",
zone_name="zone1",
relative_record_set_name="@",
record_type="SOA",
)
print(response)
# x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetSOARecordset.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armdns_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetSOARecordset.json
func ExampleRecordSetsClient_Get_getSoaRecordset() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armdns.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewRecordSetsClient().Get(ctx, "rg1", "zone1", "@", armdns.RecordTypeSOA, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.RecordSet = armdns.RecordSet{
// Name: to.Ptr("@"),
// Type: to.Ptr("Microsoft.Network/dnsZones/SOA"),
// Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/SOA/@"),
// Properties: &armdns.RecordSetProperties{
// SoaRecord: &armdns.SoaRecord{
// Email: to.Ptr("hostmaster.contoso.com"),
// ExpireTime: to.Ptr[int64](2419200),
// Host: to.Ptr("ns1.contoso.com"),
// MinimumTTL: to.Ptr[int64](300),
// RefreshTime: to.Ptr[int64](3600),
// RetryTime: to.Ptr[int64](300),
// SerialNumber: to.Ptr[int64](1),
// },
// TTL: to.Ptr[int64](3600),
// Fqdn: to.Ptr("zone1"),
// Metadata: map[string]*string{
// "key1": to.Ptr("value1"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { DnsManagementClient } = require("@azure/arm-dns");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets a record set.
*
* @summary Gets a record set.
* x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetSOARecordset.json
*/
async function getSoaRecordset() {
const subscriptionId = "subid";
const resourceGroupName = "rg1";
const zoneName = "zone1";
const relativeRecordSetName = "@";
const recordType = "SOA";
const credential = new DefaultAzureCredential();
const client = new DnsManagementClient(credential, subscriptionId);
const result = await client.recordSets.get(
resourceGroupName,
zoneName,
relativeRecordSetName,
recordType
);
console.log(result);
}
getSoaRecordset().catch(console.error);
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/SOA/@",
"etag": "00000000-0000-0000-0000-000000000000",
"name": "@",
"type": "Microsoft.Network/dnsZones/SOA",
"properties": {
"metadata": {
"key1": "value1"
},
"TTL": 3600,
"fqdn": "zone1",
"SOARecord": {
"host": "ns1.contoso.com",
"email": "hostmaster.contoso.com",
"serialNumber": 1,
"refreshTime": 3600,
"retryTime": 300,
"expireTime": 2419200,
"minimumTTL": 300
}
}
}
Get SRV recordset
Sample Request
GET https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/SRV/record1?api-version=2018-05-01
import com.azure.resourcemanager.dns.models.RecordType;
/** Samples for RecordSets Get. */
public final class Main {
/*
* x-ms-original-file:
* specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetSRVRecordset.json
*/
/**
* Sample code: Get SRV recordset.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getSRVRecordset(com.azure.resourcemanager.AzureResourceManager azure) {
azure.dnsZones().manager().serviceClient().getRecordSets().getWithResponse("rg1", "zone1", "record1",
RecordType.SRV, com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.dns import DnsManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-dns
# USAGE
python get_srv_recordset.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = DnsManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.record_sets.get(
resource_group_name="rg1",
zone_name="zone1",
relative_record_set_name="record1",
record_type="SRV",
)
print(response)
# x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetSRVRecordset.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armdns_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetSRVRecordset.json
func ExampleRecordSetsClient_Get_getSrvRecordset() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armdns.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewRecordSetsClient().Get(ctx, "rg1", "zone1", "record1", armdns.RecordTypeSRV, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.RecordSet = armdns.RecordSet{
// Name: to.Ptr("record1"),
// Type: to.Ptr("Microsoft.Network/dnsZones/SRV"),
// Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/SRV/record1"),
// Properties: &armdns.RecordSetProperties{
// SrvRecords: []*armdns.SrvRecord{
// {
// Port: to.Ptr[int32](80),
// Priority: to.Ptr[int32](0),
// Target: to.Ptr("contoso.com"),
// Weight: to.Ptr[int32](10),
// }},
// TTL: to.Ptr[int64](3600),
// Fqdn: to.Ptr("record1.zone1"),
// Metadata: map[string]*string{
// "key1": to.Ptr("value1"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { DnsManagementClient } = require("@azure/arm-dns");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets a record set.
*
* @summary Gets a record set.
* x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetSRVRecordset.json
*/
async function getSrvRecordset() {
const subscriptionId = "subid";
const resourceGroupName = "rg1";
const zoneName = "zone1";
const relativeRecordSetName = "record1";
const recordType = "SRV";
const credential = new DefaultAzureCredential();
const client = new DnsManagementClient(credential, subscriptionId);
const result = await client.recordSets.get(
resourceGroupName,
zoneName,
relativeRecordSetName,
recordType
);
console.log(result);
}
getSrvRecordset().catch(console.error);
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/SRV/record1",
"etag": "00000000-0000-0000-0000-000000000000",
"name": "record1",
"type": "Microsoft.Network/dnsZones/SRV",
"properties": {
"metadata": {
"key1": "value1"
},
"TTL": 3600,
"fqdn": "record1.zone1",
"SRVRecords": [
{
"priority": 0,
"weight": 10,
"port": 80,
"target": "contoso.com"
}
]
}
}
Get TXT recordset
Sample Request
GET https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/TXT/record1?api-version=2018-05-01
import com.azure.resourcemanager.dns.models.RecordType;
/** Samples for RecordSets Get. */
public final class Main {
/*
* x-ms-original-file:
* specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetTXTRecordset.json
*/
/**
* Sample code: Get TXT recordset.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getTXTRecordset(com.azure.resourcemanager.AzureResourceManager azure) {
azure.dnsZones().manager().serviceClient().getRecordSets().getWithResponse("rg1", "zone1", "record1",
RecordType.TXT, com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.dns import DnsManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-dns
# USAGE
python get_txt_recordset.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = DnsManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.record_sets.get(
resource_group_name="rg1",
zone_name="zone1",
relative_record_set_name="record1",
record_type="TXT",
)
print(response)
# x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetTXTRecordset.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armdns_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetTXTRecordset.json
func ExampleRecordSetsClient_Get_getTxtRecordset() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armdns.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewRecordSetsClient().Get(ctx, "rg1", "zone1", "record1", armdns.RecordTypeTXT, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.RecordSet = armdns.RecordSet{
// Name: to.Ptr("record1"),
// Type: to.Ptr("Microsoft.Network/dnsZones/TXT"),
// Etag: to.Ptr("00000000-0000-0000-0000-000000000000"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/TXT/record1"),
// Properties: &armdns.RecordSetProperties{
// TTL: to.Ptr[int64](3600),
// TxtRecords: []*armdns.TxtRecord{
// {
// Value: []*string{
// to.Ptr("string1"),
// to.Ptr("string2")},
// }},
// Fqdn: to.Ptr("record1.zone1"),
// Metadata: map[string]*string{
// "key1": to.Ptr("value1"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { DnsManagementClient } = require("@azure/arm-dns");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets a record set.
*
* @summary Gets a record set.
* x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetTXTRecordset.json
*/
async function getTxtRecordset() {
const subscriptionId = "subid";
const resourceGroupName = "rg1";
const zoneName = "zone1";
const relativeRecordSetName = "record1";
const recordType = "TXT";
const credential = new DefaultAzureCredential();
const client = new DnsManagementClient(credential, subscriptionId);
const result = await client.recordSets.get(
resourceGroupName,
zoneName,
relativeRecordSetName,
recordType
);
console.log(result);
}
getTxtRecordset().catch(console.error);
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/dnsZones/zone1/TXT/record1",
"etag": "00000000-0000-0000-0000-000000000000",
"name": "record1",
"type": "Microsoft.Network/dnsZones/TXT",
"properties": {
"metadata": {
"key1": "value1"
},
"TTL": 3600,
"fqdn": "record1.zone1",
"TXTRecords": [
{
"value": [
"string1",
"string2"
]
}
]
}
}
定义
AaaaRecord
AAAA 记录。
名称 |
类型 |
说明 |
ipv6Address
|
string
|
此 AAAA 记录的 IPv6 地址。
|
ARecord
A 记录。
名称 |
类型 |
说明 |
ipv4Address
|
string
|
此 A 记录的 IPv4 地址。
|
CaaRecord
CAA 记录。
名称 |
类型 |
说明 |
flags
|
integer
|
此 CAA 的标志记录为介于 0 和 255 之间的整数。
|
tag
|
string
|
此 CAA 记录的标记。
|
value
|
string
|
此 CAA 记录的值。
|
CloudError
来自服务的错误响应。
CloudErrorBody
来自服务的错误响应。
名称 |
类型 |
说明 |
code
|
string
|
错误的标识符。 代码是固定的,旨在以编程方式使用。
|
details
|
CloudErrorBody[]
|
有关错误的其他详细信息的列表。
|
message
|
string
|
描述错误的消息,该消息适用于在用户界面中显示。
|
target
|
string
|
特定错误的目标。 例如,属性的名称出错。
|
CnameRecord
CNAME 记录。
名称 |
类型 |
说明 |
cname
|
string
|
此 CNAME 记录的规范名称。
|
MxRecord
MX 记录。
名称 |
类型 |
说明 |
exchange
|
string
|
此 MX 记录的邮件主机的域名。
|
preference
|
integer
|
此 MX 记录的首选项值。
|
NsRecord
NS 记录。
名称 |
类型 |
说明 |
nsdname
|
string
|
此 NS 记录的名称服务器名称。
|
PtrRecord
PTR 记录。
名称 |
类型 |
说明 |
ptrdname
|
string
|
此 PTR 记录的 PTR 目标域名。
|
RecordSet
描述同名和类型) 的 DNS 记录集合 (DNS 记录集。
名称 |
类型 |
说明 |
etag
|
string
|
记录集的 etag。
|
id
|
string
|
记录集的 ID。
|
name
|
string
|
记录集的名称。
|
properties.AAAARecords
|
AaaaRecord[]
|
记录集中的 AAAA 记录的列表。
|
properties.ARecords
|
ARecord[]
|
记录集中的 A 记录的列表。
|
properties.CNAMERecord
|
CnameRecord
|
记录集中的 CNAME 记录。
|
properties.MXRecords
|
MxRecord[]
|
记录集中 MX 记录的列表。
|
properties.NSRecords
|
NsRecord[]
|
记录集中的 NS 记录列表。
|
properties.PTRRecords
|
PtrRecord[]
|
记录集中的 PTR 记录列表。
|
properties.SOARecord
|
SoaRecord
|
记录集中的 SOA 记录。
|
properties.SRVRecords
|
SrvRecord[]
|
记录集中的 SRV 记录列表。
|
properties.TTL
|
integer
|
TTL (记录集中记录的生存时间) 。
|
properties.TXTRecords
|
TxtRecord[]
|
记录集中 TXT 记录的列表。
|
properties.caaRecords
|
CaaRecord[]
|
记录集中 CAA 记录的列表。
|
properties.fqdn
|
string
|
记录集的完全限定域名。
|
properties.metadata
|
object
|
附加到记录集的元数据。
|
properties.provisioningState
|
string
|
记录集的预配状态。
|
properties.targetResource
|
SubResource
|
对从中获取 dns 资源值的 Azure 资源的引用。
|
type
|
string
|
记录集的类型。
|
RecordType
此记录集中的 DNS 记录的类型。
名称 |
类型 |
说明 |
A
|
string
|
|
AAAA
|
string
|
|
CAA
|
string
|
|
CNAME
|
string
|
|
MX
|
string
|
|
NS
|
string
|
|
PTR
|
string
|
|
SOA
|
string
|
|
SRV
|
string
|
|
TXT
|
string
|
|
SoaRecord
SOA 记录。
名称 |
类型 |
说明 |
email
|
string
|
此 SOA 记录的电子邮件联系人。
|
expireTime
|
integer
|
此 SOA 记录的过期时间。
|
host
|
string
|
此 SOA 记录的权威名称服务器的域名。
|
minimumTTL
|
integer
|
此 SOA 记录的最小值。 按照约定,这用于确定负缓存持续时间。
|
refreshTime
|
integer
|
此 SOA 记录的刷新值。
|
retryTime
|
integer
|
此 SOA 记录的重试时间。
|
serialNumber
|
integer
|
此 SOA 记录的序列号。
|
SrvRecord
SRV 记录。
名称 |
类型 |
说明 |
port
|
integer
|
此 SRV 记录的端口值。
|
priority
|
integer
|
此 SRV 记录的优先级值。
|
target
|
string
|
此 SRV 记录的目标域名。
|
weight
|
integer
|
此 SRV 记录的权重值。
|
SubResource
对另一资源的引用
名称 |
类型 |
说明 |
id
|
string
|
资源 ID。
|
TxtRecord
TXT 记录。
名称 |
类型 |
说明 |
value
|
string[]
|
此 TXT 记录的文本值。
|