Skip to main content

azure_dns_zones_resources resource

Use the azure_dns_zones_resources InSpec audit resource to test the properties related to all Azure DNS zones for a resource group or an entire subscription.

Azure REST API version, endpoint, and HTTP client parameters

This resource interacts with API versions supported by the resource provider. You can specify the api_version as a resource parameter to use a specific version of the Azure REST API. If you don’t specify an API version, this resource uses the latest version available. For more information about API versioning, see the azure_generic_resource.

By default, this resource uses the azure_cloud global endpoint and default HTTP client settings. You can override these settings if you need to connect to a different Azure environment (such as Azure Government or Azure China). For more information about configuration options, see the resource pack README.

Syntax

An azure_dns_zones_resources resource block returns all Azure DNS Zones within a resource group.

describe azure_dns_zones_resources do
  #...
end

Parameters

This resource does not require any parameters.

Properties

name
A list of the unique resource names.

Field: name

ids
A list of DNS zone IDs.

Field: id

tags
A list of tag:value pairs defined on the resources.

Field: tags

types
A list of the types of all DNS zones.

Field: type

properties
A list of the properties of the Azure DNS zone resources.

Field: properties

max_number_of_recordsets
A list of the maximum number of records per record set that can be created in the DNS zones.

Field: max_number_of_recordsets

number_of_record_sets
A list of the current number of record sets in the DNS zones.

Field: number_of_record_sets

name_servers
A list of the name servers for the DNS zones.

Field: name_servers

Note

For information on using filter criteria on plural resources, see the documentation on FilterTable

Examples

Test that a DNS zone has the correct type:

describe azure_dns_zones_resources do
  its('type') { should include 'Microsoft.Network/dnszones' }
end

Test that a DNS zone resource has a ‘Succeeded’ provisioning state:

describe azure_dns_zones_resources do
  its('provisioning_states') { should include 'Succeeded' }
end

Test that a DNS zone has the ‘global’ location:

describe azure_dns_zones_resources do
  its('location') { should include 'global' }
end

Test if any Azure DNS zone exists in the resource group:

describe azure_dns_zones_resources do
  it { should exist }
end

Matchers

For a full list of available matchers, see our Universal Matchers page.

This resource has the following special matchers.

exists

Test that there are not any Azure DNS zones in the resource group.

describe azure_dns_zones_resources do
  it { should_not exist }
end

Azure permissions

Your Service Principal must be set up with at least a contributor role on the subscription you wish to test.

Thank you for your feedback!

×