pythonazureazure-data-lake-gen2azure-python-sdkazure-purview

Create Purview scan with Python SDK with a specified scope/folderpath for an AdlsGen2 resource


I am trying to automatically deploy my Purview solution using the Python SDK using this Microsoft documentation and the documentation of the Azure SDK itself.

I want to create a scan of an AdlsGen2 resource, but instead of scanning the entire resource, I only want to scan a specified folder path. I know this is possible in the Purview Studio UI, but I want to fix this programmatically.

I am now using a body in this form:

body = {
 "kind":"AdlsGen2Msi",
 "properties": { 
 "scanRulesetName": "AdlsGen2", 
 "scanRulesetType": "System",
 "collection": 
  {
  "referenceName": collection_name,
  "type": "CollectionReference"
  }
 }
}

This works in creating a scan on the whole AdlsGen2. I can't find an option for "scope" or "path" or something like that.

Or is this possible in some other way? I saw a possibility to specify a folder path using resource sets, but I don't feel that is what I want. I am still learning about Purview, so I don't have all options figured out yet.

Thanks!


Solution

  • Currently, Azure Purview Python SDK does not provide a direct way to specify the folder path while creating a scan for AdlsGen2 resource programmatically. The Purview Studio UI can be used to manually set up scans for a specific folder path, but I am not sure if this feature is available in the Python SDK.

    I would suggest using the resource sets property in the body dictionary to specify a folder path. The resourceSet property should include the scope property, which specifies the folder path to scan. Here is an example of how to modify your body dictionary:

    body = { "kind": "AdlsGen2Msi", "properties": { "scanRulesetName": "AdlsGen2", "scanRulesetType": "System", "collection": { "referenceName": collection_name, "type": "CollectionReference" }, "resourceSet": { "scope": folder_path } } }

    folder_path should be replaced with the specific folder path you want to scan.