tayganr / purviewcli

Microsoft Purview CLI
https://aka.ms/purviewcli
MIT License
48 stars 27 forks source link

Resource not found error adding AzureBlob data source #11

Closed JoshArmi closed 3 years ago

JoshArmi commented 3 years ago

This is probably user error, but I'm attempting to add an Azure Storage Account. I can do it through the portal successfully, but cannot make it work with the following JSON.

{ "id": "datasources/AzureStorage", "kind": "AzureStorage", "name": "AzureStorage", "properties": { "collection": null, "endpoint": "https://armitagencypurview.blob.core.windows.net/", "location": "westeurope", "parentCollection": null, "resourceGroup": "purview-resources", "resourceName": "armitagencypurview", "subscriptionId": "57c28f9c-f58a-47a6-bb0b-bfc921735b62" } }

I'm getting knocked back with Resource not found.

Any help would be greatly appreciated thank you.

tayganr commented 3 years ago

Hi @JoshArmi - With Azure Purview accounts that were created on or after the 18th August 2021 (i.e. the shift to collection-based access controls), all sources now need to have the collection property populated. I will update the JSON samples to reflect this change.

Example payload for Azure Storage:

{
    "id": "datasources/AzureStorage",
    "kind": "AzureStorage",
    "name": "AzureStorage",
    "properties": {
        "collection": {
            "referenceName": "qaomdj",
            "type": "CollectionReference"
        },
        "endpoint": "https://taygan.blob.core.windows.net/",
        "location": "westeurope",
        "resourceGroup": "taygan",
        "resourceName": "taygan",
        "subscriptionId": "2c334b6c-e556-40ac-a4c0-c0d1d2e08ca0"
    }
}
tayganr commented 3 years ago

@JoshArmi - P.S. The "referenceName" within the collection property needs to be the technical name of the collection (which is auto-generated by Purview), not the friendly name.

I still need to update purviewcli to retrieve Collection details. In the meantime, if you monitor network calls when refreshing the Data Map (e.g. using Developer Tools in Edge/Chrome), you will see a GET request to the /account/collections endpoint which will reveal this information.

image