Azure Purview - How to find the qualifiedName of a collection to use in the API

Manu Cohen-Yashar 71 Reputation points
2022-08-17T21:40:11.193+00:00

I would like to create Atlas entities in a collection and move existing Atlas entities into a collection programatically using the Purview API.
Using the portal I created a collection and called it "operations". It lives of course under the root collection of my purview account (called 'purview-adm-exp').

232174-capture4.jpg

When I try to use the API to insert or move entities to the collection I get an error message that the collection does not exist.
The name of the collection that I use in the API calls is "operations". I assume there is a unique qualified name for it but I could not find it in the portal, nor found a way to retrieve it with the API. BTW, I could not find an API to create, delete, update or read details about collections in general, and I find it wired.
With that I do not know how to use the API as I always get the following error:

232143-capture3.jpg

So my question is: What is the name of the collection that I should use in the API ? How do I find it?

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.
917 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Manu Cohen-Yashar 71 Reputation points
    2022-08-26T14:40:34.403+00:00

    All collections in the Microsoft Purview data map have a friendly name and a name.

    The friendly name is the one you see in the collection, for example, Operations.
    The name for all collections (except the root collection) is a six-character name assigned by the data map.
    Python needs this six-character name to reference any sub-collections. To convert your friendly name automatically to the six-character collection name needed in the API, use this little helper function:

    def findRealCollectionName(admin_client, collection_name):  
        collection_list = admin_client.collections.list_collections()  
        for collection in collection_list:  
            if (collection["friendlyName"].lower() == collection_name.lower()):  
                return collection["name"]  
    
    2 people found this answer helpful.