Purview - Create scan via API - 400 bad request

Saravana Kumar S 0 Reputation points
2024-08-20T07:20:11.11+00:00

I formed the below mentioned json request payload for creating a scan in purview for an Azure SQL datasource. I am able to create one under domain , but ends up with 400 bad request when tried giving a collection name. No idea on what I am missing.

scan_body = {

"kind": "AzureSqlDatabaseMsi",

"properties": {

"serverEndpoint": "mockserver.database.windows.net",

"databaseName": "mock",

"scanRulesetName": "AzureSqlDatabase",

"collection": { "referenceName": "collectionname",#Here with domain ,it works.

"type": "CollectionReference"

},

"scanRulesetType": "System"}

}

I created the above json payload based on the MS docs.

https://learn.microsoft.com/en-us/rest/api/purview/scanningdataplane/scans/create-or-replace?view=rest-purview-scanningdataplane-2023-09-01&tabs=HTTP#request-body

Suggestions please.

Microsoft Purview
Microsoft Purview
A Microsoft data governance service that helps manage and govern on-premises, multicloud, and software-as-a-service data. Previously known as Azure Purview.
1,231 questions
{count} votes

1 answer

Sort by: Most helpful
  1. NIKHILA NETHIKUNTA 3,270 Reputation points Microsoft Vendor
    2024-08-22T08:46:33.9133333+00:00

    Hi @Saravana Kumar S
    Thank you for your question and using Microsoft Q&A platform.
    It sounds like you’re encountering a 400 Bad Request error when trying to create a scan with a collection name. This error typically indicates that there’s an issue with the request payload. Here are a few things you can check:

    1. Collection Reference: Ensure that the referenceName you are using for the collection actually exists and is correctly spelled. The collection must be pre-created in Purview.
    2. JSON Structure: Verify that the JSON structure is correct and matches the expected schema. Sometimes, even a small typo or misplaced comma can cause issues.
    3. API Version: Make sure you are using the correct API version as specified in the documentation. Sometimes, different versions may have slight variations in the expected payload.

    Hope this helps. Please let me know if you have any further questions.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.