6

Developer Experiences - Manage Scanning Data Plane using REST APIs.

 3 years ago
source link: https://techcommunity.microsoft.com/t5/azure-purview/developer-experiences-manage-scanning-data-plane-using-rest-apis/ba-p/2346150?WT_mc_id=DOP-MVP-4025064
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Manage Scanning Data Plane using REST APIs.

Developer Experiences - Manage Scanning Data Plane using REST APIs.

Published 05-12-2021 10:17 AM 765 Views

We are happy to announce that REST APIs for scanning data plane are now released. Software engineers or developers in your organization can now call these APIs to register data sources, set up scans and classifications programmatically to integrate with other systems or products in your company.



Purview Scaning Data Plane Endpoints

You need to have the purview account name to call scanning APIs. Below is how the endpoint will look:

https://{your-purview-account-name}.scan.purview.azure.com



Set up authentication using service principal.

To call the scanning APIs, the first thing you need to do is to register an application and create a client secret for that application in Azure Active Directory.  When you register an application a service principal is automatically created in your tenant. For more information on how to create a service principal (application) and client secret, please refer here.



Once service principal is created, you need to assign ‘Data source Admin’ role of your purview account to the service principal created above. The below steps need to be followed to assign role to establish trust between the service principal and purview account.

You've now configured the service principal as an application administrator, which enables it to send content to the scanning APIs. Learn about roles here.



Get Token

You can send a POST request to the following URL to get access token.

https://login.microsoftonline.com/{your-tenant-id}/oauth2/token

The following parameters needs to be passed to the above URL.

Sample response token:
    "token_type": "Bearer",
    "expires_in": "86399",
    "ext_expires_in": "86399",
    "expires_on": "1621038348",
    "not_before": "1620951648",
    "resource": "https://purview.azure.net",
    "access_token": "<<access token>>"


Scanning Data Plane REST APIs

Once you have followed all the above steps and have received access token you can now call various scanning APIs programmatically. The different types of entities you can interact with are listed below:

The below examples explains the APIs you need to call to configure a data source , set up and run a scan for the data source but for complete information on all the REST APIs supported by scanning data plane refer here -



1. To create or update a data source using APIs the following REST API can be leveraged:

PUT {Endpoint}/datasources/{dataSourceName}?api-version=2018-12-01-preview



You can register an Azure storage data source with name ‘myStorage’ by sending a PUT request to the following URL

{Endpoint}/datasources/myStorage?api-version=2018-12-01-preview with the below request body:



  "name": "myStorage",

  "kind": "AzureStorage",

  "properties": {

    "endpoint": "https://azurestorage.core.windows.net/"



2. To create a scan for a data source already registered in Purview the following REST API can be leveraged:

PUT {Endpoint}/datasources/{dataSourceName}/scans/{scanName}?api-version=2018-12-01-preview



You can schedule a scan ‘myStorageScan’ using a credential ‘CredentialAKV’ and system scan rule set ‘AzureStorage’ for the already registered data source ‘myStorage’ by sending a PUT request to the following URL with the below request body:

{Endpoint}/datasources/myStorage/scans/myStorageScan?api-version=2018-12-01-preview



  "kind": "AzureStorageCredential",

  "properties": {

    "credential": {

      "referenceName": "CredentialAKV",

      "credentialType": "AccountKey"

    "connectedVia": null,

    "scanRulesetName": "AzureStorage",

    "scanRulesetType": "System"



The above call with return the following response:

  "name": "myStorageScan",

  "id": "datasources/myDataSource/scans/myScanName",

  "kind": "AzureStorageCredential",

  "properties": {

    "credential": {

      "referenceName": "CredentialAKV",

      "credentialType": "AccountKey"

    "connectedVia": null,

    "scanRulesetName": "AzureStorage",

    "scanRulesetType": "System",

    "workers": null

  "scanResults": null



3. Once the scan is created you need to add filters to the scan which is basically scoping your scan or determining what objects should be included as part of scan. To create a filter, you can leverage the following REST API

PUT {Endpoint}/datasources/{dataSourceName}/scans/{scanName}/filters/custom?api-version=2018-12-01-preview



You can create a filter for the above scan ‘myStorageScan’ by sending a PUT request to the following URL with the below request body. This will create a scope to include folders /share1/user and /share1/aggregated and exclude folder /share1/user/temp/ as part of the scan.

{Endpoint}/datasources/myStorage/scans/myStorageScan/filters/custom?api-version=2018-12-01-preview

  "properties": {

    "includeUriPrefixes": [

      "https://myStorage.file.core.windows.net/share1/user",

      "https://myStorage.file.core.windows.net/share1/aggregated"

    "excludeUriPrefixes": [

      "https://myStorage.file.core.windows.net/share1/user/temp"



The above call will return the following response:

  "name": "custom",

  "id": "datasources/myStorage/scans/myStorageScan/filters/custom",

  "properties": {

    "includeUriPrefixes": [

      "https://myStorage.file.core.windows.net/share1/user",

      "https://myStorage.file.core.windows.net/share1/aggregated"

    "excludeUriPrefixes": [

      "https://myStorage.file.core.windows.net/share1/user/temp"



4.To run a scan, you need to use the following REST API

PUT {Endpoint}/datasources/{dataSourceName}/scans/{scanName}/runs/{runId}?api-version=2018-12-01-preview



You can now trigger the above scan ‘myStorageScan’ by sending a PUT request to the below URL. The runId is a guid.

{Endpoint}/datasources/myStorage/scans/myStorageScan/runs/138301e4-f4f9-4ab5-b734-bac446b236e7?api-version=2018-12-01-preview



The above call will return the following response:

  "scanResultId": "138301e4-f4f9-4ab5-b734-bac446b236e7",

  "startTime": "2019-05-16T17:01:37.3089193Z",

  "endTime": null,

  "status": "Accepted",

  "error": null



To learn more about Azure Purview, check out our full documentation today.





You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.

%3CLINGO-SUB%20id%3D%22lingo-sub-2346150%22%20slang%3D%22en-US%22%3EDeveloper%20Experiences%20-%20Manage%20Scanning%20Data%20Plane%20using%20REST%20APIs.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2346150%22%20slang%3D%22en-US%22%3E%3CP%3EWe%20are%20happy%20to%20announce%20that%20REST%20APIs%20for%20scanning%20%3CA%20title%3D%22data%20plane%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-resource-manager%2Fmanagement%2Fcontrol-plane-and-data-plane%23data-plane%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Edata%20plane%3C%2FA%3E%20are%20now%20released.%20Software%20engineers%20or%20developers%20in%20your%20organization%20can%20now%20call%20these%20APIs%20to%20register%20data%20sources%2C%20set%20up%20scans%20and%20classifications%20programmatically%20to%20integrate%20with%20other%20systems%20or%20products%20in%20your%20company.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId-1329210252%22%20id%3D%22toc-hId-1329120904%22%3EP%3CSPAN%3Eurview%20Scaning%20Data%20Plane%20Endpoints%3C%2FSPAN%3E%3C%2FH1%3E%0A%3CP%3EYou%20need%20to%20have%20the%20purview%20account%20name%20to%20call%20scanning%20APIs.%20Below%20is%20how%20the%20endpoint%20will%20look%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2F%257byour-purview-account-name%257d.scan.purview.azure.com%2Fapi%2Fatlas%2Fv2%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2F%7Byour-purview-account-name%7D.scan.purview.azure.com%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId--478244211%22%20id%3D%22toc-hId--478333559%22%3ESet%20up%20authentication%20using%20service%20principal.%3C%2FH1%3E%0A%3CP%3ETo%20call%20the%20scanning%20APIs%2C%20the%20first%20thing%20you%20need%20to%20do%20is%20to%20register%20an%20application%20and%20create%20a%20client%20secret%20for%20that%20application%20in%20Azure%20Active%20Directory.%20%26nbsp%3BWhen%20you%20register%20an%20application%20a%20service%20principal%20is%20automatically%20created%20in%20your%20tenant.%20For%20more%20information%20on%20how%20to%20create%20a%20service%20principal%20(application)%20and%20client%20secret%2C%20please%20refer%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Factive-directory%2Fdevelop%2Fhowto-create-service-principal-portal%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOnce%20service%20principal%20is%20created%2C%20you%20need%20to%20assign%20%E2%80%98Data%20source%20Admin%E2%80%99%20role%20of%20your%20purview%20account%20to%20the%20service%20principal%20created%20above.%20The%20below%20steps%20need%20to%20be%20followed%20to%20assign%20role%20to%20establish%20trust%20between%20the%20service%20principal%20and%20purview%20account.%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3ENavigate%20to%20your%20Purview%20account.%3C%2FLI%3E%0A%3CLI%3EOn%20the%26nbsp%3BPurview%20account%26nbsp%3Bpage%2C%20select%20the%20tab%26nbsp%3BAccess%20control%20(IAM)%3C%2FLI%3E%0A%3CLI%3EClick%26nbsp%3B%3CEM%3E%2B%20Add.%3C%2FEM%3E%3C%2FLI%3E%0A%3CLI%3ESelect%26nbsp%3BAdd%20role%20assignment.%3C%2FLI%3E%0A%3CLI%3EFor%20the%20Role%20select%26nbsp%3B%3CEM%3EPurview%20Data%20Source%20Administrator%3C%2FEM%3E%20from%20the%20drop%20down.%3C%2FLI%3E%0A%3CLI%3EFor%26nbsp%3BAssign%20access%20to%26nbsp%3Bleave%20the%20default%2C%26nbsp%3BUser%2C%20group%2C%20or%20service%20principal.%3C%2FLI%3E%0A%3CLI%3EFor%26nbsp%3BSelect%26nbsp%3Benter%20the%20name%20of%20the%20previously%20created%20service%20principal%20you%20wish%20to%20assign%20and%20then%20click%20on%20their%20name%20in%20the%20results%20pane.%3C%2FLI%3E%0A%3CLI%3EClick%20on%26nbsp%3BSave.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EYou've%20now%20configured%20the%20service%20principal%20as%20an%20application%20administrator%2C%20which%20enables%20it%20to%20send%20content%20to%20the%20scanning%20APIs.%20Learn%20about%20roles%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fpurview%2Fcatalog-permissions%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId-2009268622%22%20id%3D%22toc-hId-2009179274%22%3EGet%20Token%3C%2FH1%3E%0A%3CP%3EYou%20can%20send%20a%20POST%20request%20to%20the%20following%20URL%20to%20get%20access%20token.%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Flogin.microsoftonline.com%2F%257byour-tenant-id%257d%2Foauth2%2Ftoken%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F%7Byour-tenant-id%7D%2Foauth2%2Ftoken%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EThe%20following%20parameters%20needs%20to%20be%20passed%20to%20the%20above%20URL.%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3Eclient_id%3A%26nbsp%3B%20client%20id%20of%20the%20application%20registered%20in%20Azure%20Active%20directory%20and%20is%20assigned%20%E2%80%98Data%20Source%20Admin%E2%80%99%20role%20for%20the%20Purview%20account.%3C%2FLI%3E%0A%3CLI%3Eclient_secret%3A%20client%20secret%20created%20for%20the%20above%20application.%3C%2FLI%3E%0A%3CLI%3Egrant_type%3A%20This%20should%20be%20%E2%80%98client_credentials%E2%80%99.%3C%2FLI%3E%0A%3CLI%3Eresource%3A%20This%20should%20be%20%E2%80%98%3CA%20href%3D%22https%3A%2F%2Fpurview.azure.net%E2%80%99%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fpurview.azure.net%E2%80%99%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3ESample%20response%20token%3A%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%7B%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%22token_type%22%3C%2FSPAN%3E%3CSPAN%3E%3A%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%22Bearer%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%22expires_in%22%3C%2FSPAN%3E%3CSPAN%3E%3A%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%2286399%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%22ext_expires_in%22%3C%2FSPAN%3E%3CSPAN%3E%3A%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%2286399%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%22expires_on%22%3C%2FSPAN%3E%3CSPAN%3E%3A%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%221621038348%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%22not_before%22%3C%2FSPAN%3E%3CSPAN%3E%3A%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%221620951648%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%22resource%22%3C%2FSPAN%3E%3CSPAN%3E%3A%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%22%3CA%20href%3D%22https%3A%2F%2Fpurview.azure.net%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fpurview.azure.net%3C%2FA%3E%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%22access_token%22%3C%2FSPAN%3E%3CSPAN%3E%3A%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%22%26lt%3B%3CACCESS%20token%3D%22%22%3E%26gt%3B%22%3C%2FACCESS%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH1%20id%3D%22toc-hId-201814159%22%20id%3D%22toc-hId-201724811%22%3EScanning%20Data%20Plane%20REST%20APIs%3C%2FH1%3E%0A%3CP%3EOnce%20you%20have%20followed%20all%20the%20above%20steps%20and%20have%20received%20access%20token%20you%20can%20now%20call%20various%20scanning%20APIs%20programmatically.%20The%20different%20types%20of%20entities%20you%20can%20interact%20with%20are%20listed%20below%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EClassification%20Rules%3C%2FLI%3E%0A%3CLI%3EData%20Sources%3C%2FLI%3E%0A%3CLI%3EKey%20Vault%20Connections%3C%2FLI%3E%0A%3CLI%3EScans%20and%20scan%20related%20functionality%20like%20triggers%20and%20scan%20rule%20sets.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EThe%20below%20examples%20explains%20the%20APIs%20you%20need%20to%20call%20to%20configure%20a%20data%20source%20%2C%20set%20up%20and%20run%20a%20scan%20for%20the%20data%20source%20but%20for%20complete%20information%20on%20all%20the%20REST%20APIs%20supported%20by%20scanning%20data%20plane%20refer%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Frest%2Fapi%2Fpurview%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehere%3C%2FA%3E%20-%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E1.%20To%20create%20or%20update%20a%20data%20source%20using%20APIs%20the%20following%20REST%20API%20can%20be%20leveraged%3A%3C%2FP%3E%0A%3CP%3EPUT%20%3CEM%3E%7BEndpoint%7D%2Fdatasources%2F%7BdataSourceName%7D%3Fapi-version%3D2018-12-01-preview%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20register%20an%20Azure%20storage%20data%20source%20with%20name%20%E2%80%98%3CEM%3EmyStorage%3C%2FEM%3E%E2%80%99%20by%20sending%20a%20PUT%20request%20to%20the%20following%20URL%3C%2FP%3E%0A%3CP%3E%3CEM%3E%7BEndpoint%7D%2Fdatasources%2FmyStorage%3Fapi-version%3D2018-12-01-preview%20%3C%2FEM%3Ewith%20the%20below%20request%20body%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%7B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%22name%22%3A%20%22myStorage%22%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%22kind%22%3A%20%22AzureStorage%22%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%22properties%22%3A%20%7B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22endpoint%22%3A%20%22%3CA%20href%3D%22https%3A%2F%2Fazurestorage.core.windows.net%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fazurestorage.core.windows.net%2F%3C%2FA%3E%22%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%7D%3C%2FP%3E%0A%3CP%3E%7D%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E2.%20To%20create%20a%20scan%20for%20a%20data%20source%20already%20registered%20in%20Purview%20the%20following%20REST%20API%20can%20be%20leveraged%3A%3C%2FP%3E%0A%3CP%3EPUT%20%3CEM%3E%7BEndpoint%7D%2Fdatasources%2F%7BdataSourceName%7D%2Fscans%2F%7BscanName%7D%3Fapi-version%3D2018-12-01-preview%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20schedule%20a%20scan%20%E2%80%98%3CEM%3EmyStorageScan%3C%2FEM%3E%E2%80%99%20using%20a%20credential%20%E2%80%98%3CEM%3ECredentialAKV%3C%2FEM%3E%E2%80%99%20and%20system%20scan%20rule%20set%20%E2%80%98%3CEM%3EAzureStorage%3C%2FEM%3E%E2%80%99%20for%20the%20already%20registered%20data%20source%20%E2%80%98%3CEM%3EmyStorage%3C%2FEM%3E%E2%80%99%20by%20sending%20a%20PUT%20request%20to%20the%20following%20URL%20with%20the%20below%20request%20body%3A%3C%2FP%3E%0A%3CP%3E%3CEM%3E%7BEndpoint%7D%2Fdatasources%2FmyStorage%2Fscans%2FmyStorageScan%3Fapi-version%3D2018-12-01-preview%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%7B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%22kind%22%3A%20%22AzureStorageCredential%22%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%22properties%22%3A%20%7B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22credential%22%3A%20%7B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22referenceName%22%3A%20%22CredentialAKV%22%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22credentialType%22%3A%20%22AccountKey%22%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22connectedVia%22%3A%20null%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22scanRulesetName%22%3A%20%22AzureStorage%22%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22scanRulesetType%22%3A%20%22System%22%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%7D%3C%2FP%3E%0A%3CP%3E%7D%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20above%20call%20with%20return%20the%20following%20response%3A%3C%2FP%3E%0A%3CP%3E%7B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%22name%22%3A%20%22myStorageScan%22%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%22id%22%3A%20%22datasources%2FmyDataSource%2Fscans%2FmyScanName%22%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%22kind%22%3A%20%22AzureStorageCredential%22%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%22properties%22%3A%20%7B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22credential%22%3A%20%7B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22referenceName%22%3A%20%22CredentialAKV%22%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22credentialType%22%3A%20%22AccountKey%22%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22connectedVia%22%3A%20null%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22scanRulesetName%22%3A%20%22AzureStorage%22%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22scanRulesetType%22%3A%20%22System%22%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22workers%22%3A%20null%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%7D%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%22scanResults%22%3A%20null%3C%2FP%3E%0A%3CP%3E%7D%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E3.%20Once%20the%20scan%20is%20created%20you%20need%20to%20add%20filters%20to%20the%20scan%20which%20is%20basically%20scoping%20your%20scan%20or%20determining%20what%20objects%20should%20be%20included%20as%20part%20of%20scan.%20To%20create%20a%20filter%2C%20you%20can%20leverage%20the%20following%20REST%20API%3C%2FP%3E%0A%3CP%3EPUT%20%3CEM%3E%7BEndpoint%7D%2Fdatasources%2F%7BdataSourceName%7D%2Fscans%2F%7BscanName%7D%2Ffilters%2Fcustom%3Fapi-version%3D2018-12-01-preview%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20create%20a%20filter%20for%20the%20above%20scan%20%E2%80%98myStorageScan%E2%80%99%20by%20sending%20a%20PUT%20request%20to%20the%20following%20URL%20with%20the%20below%20request%20body.%20This%20will%20create%20a%20scope%20to%20include%20folders%20%2Fshare1%2Fuser%20and%20%2Fshare1%2Faggregated%20and%20exclude%20folder%20%2Fshare1%2Fuser%2Ftemp%2F%20as%20part%20of%20the%20scan.%3C%2FP%3E%0A%3CP%3E%3CEM%3E%7BEndpoint%7D%2Fdatasources%2FmyStorage%2Fscans%2FmyStorageScan%2Ffilters%2Fcustom%3Fapi-version%3D2018-12-01-preview%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%7B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%22properties%22%3A%20%7B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22includeUriPrefixes%22%3A%20%5B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22%3CA%20href%3D%22https%3A%2F%2FmyStorage.file.core.windows.net%2Fshare1%2Fuser%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2FmyStorage.file.core.windows.net%2Fshare1%2Fuser%3C%2FA%3E%22%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22%3CA%20href%3D%22https%3A%2F%2FmyStorage.file.core.windows.net%2Fshare1%2Faggregated%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2FmyStorage.file.core.windows.net%2Fshare1%2Faggregated%3C%2FA%3E%22%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%5D%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22excludeUriPrefixes%22%3A%20%5B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22%3CA%20href%3D%22https%3A%2F%2FmyStorage.file.core.windows.net%2Fshare1%2Fuser%2Ftemp%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2FmyStorage.file.core.windows.net%2Fshare1%2Fuser%2Ftemp%3C%2FA%3E%22%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%5D%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%7D%3C%2FP%3E%0A%3CP%3E%7D%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20above%20call%20will%20return%20the%20following%20response%3A%3C%2FP%3E%0A%3CP%3E%7B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%22name%22%3A%20%22custom%22%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%22id%22%3A%20%22datasources%2FmyStorage%2Fscans%2FmyStorageScan%2Ffilters%2Fcustom%22%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%22properties%22%3A%20%7B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22includeUriPrefixes%22%3A%20%5B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22%3CA%20href%3D%22https%3A%2F%2FmyStorage.file.core.windows.net%2Fshare1%2Fuser%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2FmyStorage.file.core.windows.net%2Fshare1%2Fuser%3C%2FA%3E%22%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22%3CA%20href%3D%22https%3A%2F%2FmyStorage.file.core.windows.net%2Fshare1%2Faggregated%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2FmyStorage.file.core.windows.net%2Fshare1%2Faggregated%3C%2FA%3E%22%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%5D%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22excludeUriPrefixes%22%3A%20%5B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22%3CA%20href%3D%22https%3A%2F%2FmyStorage.file.core.windows.net%2Fshare1%2Fuser%2Ftemp%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2FmyStorage.file.core.windows.net%2Fshare1%2Fuser%2Ftemp%3C%2FA%3E%22%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%5D%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%7D%3C%2FP%3E%0A%3CP%3E%7D%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E4.To%20run%20a%20scan%2C%20you%20need%20to%20use%20the%20following%20REST%20API%3C%2FP%3E%0A%3CP%3EPUT%20%3CEM%3E%7BEndpoint%7D%2Fdatasources%2F%7BdataSourceName%7D%2Fscans%2F%7BscanName%7D%2Fruns%2F%7BrunId%7D%3Fapi-version%3D2018-12-01-preview%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20now%20trigger%20the%20above%20scan%20%E2%80%98myStorageScan%E2%80%99%20by%20sending%20a%20PUT%20request%20to%20the%20below%20URL.%20The%20runId%20is%20a%20guid.%3C%2FP%3E%0A%3CP%3E%3CEM%3E%7BEndpoint%7D%2Fdatasources%2FmyStorage%2Fscans%2FmyStorageScan%2Fruns%2F138301e4-f4f9-4ab5-b734-bac446b236e7%3Fapi-version%3D2018-12-01-preview%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20above%20call%20will%20return%20the%20following%20response%3A%3C%2FP%3E%0A%3CP%3E%7B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%22scanResultId%22%3A%20%22138301e4-f4f9-4ab5-b734-bac446b236e7%22%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%22startTime%22%3A%20%222019-05-16T17%3A01%3A37.3089193Z%22%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%22endTime%22%3A%20null%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%22status%22%3A%20%22Accepted%22%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%22error%22%3A%20null%3C%2FP%3E%0A%3CP%3E%7D%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ETo%20learn%20more%20about%20Azure%20Purview%2C%20check%20out%20our%20full%20documentation%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fpurview%2Fcreate-catalog-portal%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Etoday%3C%2FA%3E%3CSPAN%3E.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-2346150%22%20slang%3D%22en-US%22%3E%3CP%3ELearn%20about%20how%20to%20register%20a%20data%20source%2C%20set%20up%20scans%2C%20custom%20classifications%2C%20scan%20rule%20sets%20etc.%20using%20REST%20APIs.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2346150%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%20Purview%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Edata%20catalog%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EData%20Governance%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E

Version history
Last update:

‎May 14 2021 04:51 PM

Updated by:

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK