azure_db_migration_service resource
Use the azure_db_migration_service InSpec audit resource to test the properties related to a Azure DB Migration Service.
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
resource_group and service_name are required parameter.
describe azure_db_migration_service(resource_group: 'RESOURCE_GROUP', service_name: 'SERVICE_NAME') do
it { should exist }
its('name') { should cmp 'inspec-cloud-pack-test' }
its('type') { should cmp 'Microsoft.DataMigration/services' }
its('sku.name') { should cmp 'Basic_1vCore' }
its('sku.size') { should cmp '1 vCore' }
its('location') { should cmp 'southcentralus' }
end
describe azure_db_migration_service(resource_group: 'RESOURCE_GROUP', service_name: 'SERVICE_NAME') do
it { should exist }
end
Parameters
resource_group- Azure resource group where the targeted resource resides.
service_name- Name of the Azure DB Migration service to test.
The parameter set should be provided for a valid query: resource_group and service_name.
Properties
id- Resource ID.
name- DB Migration Service Name.
location- DB Migration Service Location.
type- Resource type.
kind- The resource kind.
etag- HTTP strong entity tag value. Ignored if submitted.
sku.name- The unique name of the SKU, such as ‘P3’.
sku.size- The size of the SKU, used when the name alone does not denote a service size or when a SKU has multiple performance classes within a family. For example, ‘A1’ for virtual machines.
sku.tier- The tier of the SKU, such as ‘Free’, ‘Basic’, ‘Standard’, or ‘Premium’.
- Resource tags.
properties.provisioningState- The resource’s provisioning state.
properties.virtualSubnetId- The ID of the
Microsoft.Network/virtualNetworks/subnetsresource to which the service should be joined. properties.virtualNicId- The ID of the Azure Network Interface.
For properties applicable to all resources, such as type, name, id, and properties, refer to azure_generic_resource.
Also, see the Azure documentation for other available properties.
You can access any attribute in the response with the key names separated by dots (.).
Examples
describe azure_db_migration_service(resource_group: 'RESOURCE_GROUP', service_name: 'NAME') do
its('properties.provisioningState') { should eq 'Succeeded' }
end
describe azure_db_migration_service(resource_group: 'RESOURCE_GROUP', service_name: 'NAME') do
its('sku.name') { should 'Standard_1vCores' }
end
Matchers
For a full list of available matchers, see our Universal Matchers page.exists
# If a azure_db_migration_service is found, it will exist.
describe azure_db_migration_service(resource_group: 'RESOURCE_GROUP', service_name: 'NAME') do
it { should exist }
end
not_exists
# azure_db_migration_services that aren't found, will not exist.
describe azure_db_migration_service(resource_group: 'RESOURCE_GROUP', service_name: 'NAME') 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.