azure_migrate_project_database_instance Resource
Use the azure_migrate_project_database_instance
InSpec audit resource to test the properties of a single Azure Migrate Project database instance.
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
describe azure_migrate_project_database_instance(resource_group: 'RESOURCE_GROUP', project_name: 'PROJECT_NAME', name: 'DB_NAME') do
it { should exist }
its('name') { should eq 'sql_db' }
its('type') { should eq 'Microsoft.Migrate/MigrateProjects/DatabaseInstances' }
its('solutionNames') { should include 'migrateDBSolution' }
end
describe azure_migrate_project_database_instance(resource_group: 'RESOURCE_GROUP', project_name: 'PROJECT_NAME', name: 'DB_NAME') do
it { should exist }
end
Parameters
name
(required)Unique name of a database in Azure migration hub.
resource_group
(required)Name of the Azure Resource Group where the migrate project is part.
project_name
(required)Name of the Azure Migrate project.
Properties
id
- Path reference to the Migrate project database instance.
name
- Unique name of an Migrate project database instance.
type
- Type of the object.
Microsoft.Migrate/MigrateProjects/Databases
. properties
- The properties of the machine.
properties.discoveryData
- The assessment details of the database instance published by various sources.
properties.summary
- The database instances summary per solution.
enqueueTimes
- The time when the message was enqueued.
extendedInfos
- The extended properties of the database server.
hostNames
- The host names of the database servers.
instanceIds
- The database instance IDs.
instanceNames
- The database instance names.
instanceTypes
- The database instance types.
instanceVersions
- The database instance versions.
ipAddresses
- The IP addresses of the database server. IP addresses could be IPv4 or IPv6.
lastUpdatedTimes
- The time of the last modification of the database instance details.
portNumbers
- The port numbers of the database server.
solutionNames
- The names of the solution that sent the data.
For properties applicable to all resources, such as type
, name
, id
, and properties
, refer to azure_generic_resource
.
Also, refer to Azure documentation for other properties available.
Any attribute in the response nested within properties may be accessed with the key names separated by dots (.
), and attributes nested in the assessment data is pluralized and listed as a collection.
Examples
Test that the Migrate Project database instance has a SQL instanceType
describe azure_migrate_project_database_instance(resource_group: 'RESOURCE_GROUP', project_name: 'PROJECT_NAME', name: 'DB_NAME') do
its('instanceTypes') { should include 'SQL' }
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
# If a Migrate Project database instance is found, it will exist.
describe azure_migrate_project_database_instance(resource_group: 'RESOURCE_GROUP', project_name: 'PROJECT_NAME', name: 'DB_NAME') do
it { should exist }
end
not_exists
# If Migrate Project database instance is not found, it will not exist.
describe azure_migrate_project_database_instance(resource_group: 'RESOURCE_GROUP', project_name: 'PROJECT_NAME', name: 'DB_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.