Skip to main content

azure_cdn_profile resource

Use the azure_cdn_profile Chef InSpec audit resource to test the properties and configuration of an Azure CDN profile.

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

Either the resource_group and name, or the resource_id are required .

describe azure_cdn_profile(resource_group: 'RESOURCE_GROUP', name: 'NAME') do
  it { should exist }
end
describe azure_cdn_profile(resource_id: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}') do
  it { should exist }
end

Parameters

resource_group
Azure resource group that the targeted resource resides in.
name
The unique name of the CDN profile name.
resource_id
The unique resource ID. /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}.

Provide one of the following parameter sets for a valid query:

  • resource_id
  • resource_group and name

Properties

properties.frontDoorId
The ID of the frontdoor.

For properties applicable to all resources, such as type, name, id, properties, refer to azure_generic_resource.

See the Azure CDN profile documentation for other available properties. You can access any attribute in the response with the key names separated by dots (.).

Examples

Check the resource state of a CDN profile:

describe azure_cdn_profile(resource_group: 'RESOURCE_GROUP', name: 'NAME') do
  its('properties.resourceState') { should eq 'Active' }
end

Check the resource state of all profiles in a subscription:

azure_cdn_profiles.ids.each do |id|
    describe azure_cdn_profile(resource_id: id) do
      its('properties.resourceState') { should eq 'Active' }
    end
end

Matchers

This Chef InSpec audit resource has the following special matchers. For a full list of available matchers, please visit our Universal Matchers page.

exists

Use exist if a resource should exist.

describe azure_cdn_profile(resource_group: 'RESOURCE_GROUP', name: 'NAME') do
  it { should exist }
end

Use should_not for a resource that should not exist.

describe azure_cdn_profile(resource_group: 'RESOURCE_GROUP', name: 'NAME') do
  it { should_not exist }
end

Azure permissions

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

Thank you for your feedback!

×