Skip to main content

azure_policy_exemptions Resource

Use the azure_policy_exemptions InSpec audit resource to test properties related to all Azure Policy Exemptions for the 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.

Install

This resource is available in the Chef InSpec Azure resource pack.

For information on configuring your Azure environment for Chef InSpec and creating an InSpec profile that uses the InSpec Azure resource pack, see the Chef InSpec documentation for the Azure cloud platform.

Syntax

An azure_policy_exemptions resource block returns all Azure Policy Exemptions within a subscription.

describe azure_policy_exemptions do
  #...
end

Parameters

Properties

ids
A list of the unique resource IDs.

Field: id

names
A list of names for all the resources.

Field: name

types
A list of types for all the resources.

Field: type

properties
A list of properties for all the resources.

Field: properties

system_data
A list of System Data for all the resources.

Field: system_data

policy_assignment_ids
A list of Policy Assignment IDs.

Field: policy_assignment_id

policy_definition_reference_ids
A list of Policy Definition Reference IDs.

Field: policy_definition_reference_ids

exemption_categories
A list of categories of exemptions.

Field: exemption_category

display_names
A list of display names of the exemptions.

Field: display_name

descriptions
A list of descriptions of the exemptions.

Field: description

metadata
A list of metadata info of the exemptions.

Field: metadata

created_by
A list of creators of the exemptions.

Field: created_by

created_by_types
A list of the type of creators of the exemptions.

Field: created_by_type

created_at
A list of created_at timestamps of the exemptions.

Field: created_at

last_modified_by
A list of the last modifiers of the exemptions.

Field: last_modified_by

last_modified_by_types
A list of the type of modifiers of the exemptions.

Field: last_modified_by_type

last_modified_at
A list of modified_at timestamps of the exemptions.

Field: last_modified_at

Note

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

Examples

Loop through Policy Exemptions by their names

azure_policy_exemptions.names.each do |name|
  describe azure_policy_exemption(name: name) do
    it { should exist }
  end
end

Test that there are Policy Exemptions that are of waiver exemption category

describe azure_policy_exemptions.where(exemption_category: 'Waiver') 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.

not_exists

# Should not exist if no policy exemptions are present in the subscription.

describe azure_policy_exemptions do
  it { should_not exist }
end

exists

# Should exist if the filter returns at least one policy exemption in the subscription.

describe azure_policy_exemptions do
  it { should exist }
end

Azure Permissions

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

Edit this page on GitHub

Thank you for your feedback!

×











Search Results