Skip to main content

azure_migrate_project_database_instance Resource

[edit on GitHub]

Use the azure_migrate_project_database_instance InSpec audit resource to test 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.

Installation

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

See the Chef InSpec documentation on cloud platforms for information on configuring your Azure environment for InSpec and creating an InSpec profile that uses the InSpec Azure resource pack.

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 that migrate project is part of.

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 times the message were 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, 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 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
# 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.

Was this page helpful?

×









Search Results