Skip to main content

azure_synapse_notebook resource

Use the azure_synapse_notebook InSpec audit resource to test the properties related to an Azure Synapse notebook in a Synapse workspace.

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

This resource requires the endpoint and name parameters for a valid query.

describe azure_synapse_notebook(endpoint: 'WORKSPACE_DEVELOPMENT_ENDPOINT', name: 'NOTEBOOK_NAME') do
  it { should exist }
end
describe azure_synapse_notebook(endpoint: 'WORKSPACE_DEVELOPMENT_ENDPOINT', name: 'NOTEBOOK_NAME') do
  it                                      { should exist }
  its('name')                             { should eq 'NOTEBOOK_NAME' }
  its('type')                             { should eq 'Microsoft.Synapse/workspaces/notebooks' }
  its('properties.sessionProperties.executorCores')          { should eq CORE_NUMBER }
end

Parameters

endpoint
The Azure Synapse workspace development endpoint.
name
Name of the Azure Synapse Notebook to test.

This resource requires the endpoint and name parameters for a valid query.

Properties

id
Fully qualified resource ID for the resource.
name
The name of the resource.
type
The type of the resource.
etag
The resource Etag.
properties
The properties of the notebook.

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.

Access any property in the response by separating the key names with a period (.).

Examples

Test that there are four cores for each executor:

describe azure_synapse_notebook(endpoint: 'WORKSPACE_DEVELOPMENT_ENDPOINT', name: 'NOTEBOOK_NAME') do
  its('properties.sessionProperties.executorCores') { should eq 4 }
end

Test that the notebook uses the Python kernel:

describe azure_synapse_notebook(endpoint: 'WORKSPACE_DEVELOPMENT_ENDPOINT', name: 'NOTEBOOK_NAME') do
  its('properties.metadata.language_info.name') { should 'Python' }
end

Matchers

For a full list of available matchers, see our Universal Matchers page.

exists

# If a Synapse Notebook is found, it will exist.

describe azure_synapse_notebook(endpoint: 'WORKSPACE_DEVELOPMENT_ENDPOINT', name: 'NOTEBOOK_NAME') do
  it { should exist }
end

not_exists

# Synapse Notebooks that aren't found, will not exist.

describe azure_synapse_notebook(endpoint: 'WORKSPACE_DEVELOPMENT_ENDPOINT', name: 'NOTEBOOK_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!

×