azure_dns_zones_resources Resource
Use the azure_dns_zones_resources
InSpec audit resource to test 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.
The api_version
can be defined as a resource parameter.
If not provided, this resource uses the latest version.
For more information, refer to the azure_generic_resource
document.
Unless defined, this resource uses the azure_cloud
global endpoint and default values for the HTTP client.
For more information, refer to the resource pack README.
Installation
This resource is available in the Chef InSpec Azure resource pack.
See the Chef InSpec documentation on cloud platforms for information on configuring your Azure environment for InSpec and creating an InSpec profile that uses the InSpec Azure resource pack.
Syntax
An azure_dns_zones_resources
resource block returns all Azure DNS Zones within 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
See the documentation on FilterTable for information on using filter criteria on plural resources.
Examples
Test that a DNS zone has 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
This InSpec audit resource has the following special matchers. For a full list of available matchers, please visit our Universal Matchers page.
exists
Test that there aren’t 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.