Skip to main content

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. 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

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, see the Azure documentation for other available properties.

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

For a full list of available matchers, see 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.

Thank you for your feedback!

×