Register and scan Azure Cosmos Database (SQL API)

This article outlines how to register an Azure Cosmos Database (SQL API) account in Azure Purview and set up a scan.

Supported capabilities

Azure Cosmos Database (SQL API) supports full and incremental scans to capture the metadata and schema. Scans also classify the data automatically based on system and custom classification rules.

Prerequisites

  • Before registering data sources, create an Azure Purview account. For more information on creating a Purview account, see Quickstart: Create an Azure Purview account.
  • You need to be an Azure Purview Data Source Admin

Setting up authentication for a scan

There is only one way to set up authentication for Azure Cosmos Database (SQL API):

  • Account key

Account key

When authentication method selected is Account Key, you need to get your access key and store in the key vault:

  1. Navigate to your Cosmos DB account in the Azure portal
  2. Select Settings > Keys
  3. Copy a PRIMARY or SECONDARY key from the Read-write Keys or Read-only Keys and save it somewhere for the next steps.
  4. Navigate to your key vault
  5. Select Settings > Secrets
  6. Select + Generate/Import and enter the Name and Value as the key from your Azure Cosmos DB Account.
  7. Select Create to complete
  8. If your key vault is not connected to Purview yet, you will need to create a new key vault connection
  9. Finally, create a new credential using the key to setup your scan

Register an Azure Cosmos Database (SQL API) account

To register a new Azure Cosmos Database (SQL API) account in your data catalog, do the following:

  1. Navigate to your Purview account
  2. Select Data Map on the left navigation.
  3. Select Register
  4. On Register sources, select Azure Cosmos DB (SQL API)
  5. Select Continue

register new data source

On the Register sources (Azure Cosmos DB (SQL API)) screen, do the following:

  1. Enter a Name that the data source will be listed with in the Catalog.
  2. Choose your Azure subscription to filter down Azure Cosmos DBs.
  3. Select an appropriate Cosmos DB Account name.
  4. Select a collection or create a new one (Optional).
  5. Select Register to register the data source.

register sources options

Creating and running a scan

To create and run a new scan, do the following:

  1. Select the Data Map tab on the left pane in the Purview Studio.

  2. Select the Azure Cosmos DB data source that you registered.

  3. Select New scan

  4. Select the credential to connect to your data source.

    Set up scan

  5. You can scope your scan to specific databases by choosing the appropriate items in the list.

    Scope your scan

  6. Then select a scan rule set. You can choose between the system default, existing custom rule sets, or create a new rule set inline.

    Scan rule set

  7. Choose your scan trigger. You can set up a schedule or run the scan once.

    trigger

  8. Review your scan and select Save and run.

Viewing your scans and scan runs

To view existing scans, do the following:

  1. Go to the Purview Studio. Select the Data Map tab under the left pane.

  2. Select the desired data source. You will see a list of existing scans on that data source under Recent scans, or can view all scans under the Scans tab.

  3. Select the scan that has results you want to view.

  4. This page will show you all of the previous scan runs along with the status and metrics for each scan run. It will also display whether your scan was scheduled or manual, how many assets had classifications applied, how many total assets were discovered, the start and end time of the scan, and the total scan duration.

Manage your scans - edit, delete, or cancel

To manage or delete a scan, do the following:

  1. Go to the Purview Studio. Select the Data Map tab under the left pane.

  2. Select the desired data source. You will see a list of existing scans on that data source under Recent scans, or can view all scans under the Scans tab.

  3. Select the scan you would like to manage. You can edit the scan by selecting Edit scan.

  4. You can cancel an in progress scan by selecting Cancel scan run.

  5. You can delete your scan by selecting Delete scan.

Next steps