none
How do i authenticate to and get catalog from Azure Data Catalog using Rest API in Python RRS feed

All replies

  • Hi there,

    Looks like you might be lacking appropriate permissions. You should be able to view it if you have OWNER/CONTRIBUTOR/READER Roles defined in data catalog. Please check with your DBA.

    Let us know if this helps. Else, we can gladly continue to probe in further.


    MSDN

    Monday, February 25, 2019 12:00 PM
  • Hello Chirag,

    Yeah I do actually have Administrator role in the data catalog. But first How do i authenticate to Azure Data Catalog using API and Azure Credentials in Python?

    Monday, February 25, 2019 11:15 PM
  • I found some documentation about authenticating data catalog.

    In this one, you use a Bearer Token to authenticate your REST call:
    https://docs.microsoft.com/en-us/rest/api/datacatalog/common-headers-and-parameters

    In this one you generate a token:

    https://docs.microsoft.com/en-us/rest/api/datacatalog/authenticate-a-client-app

    In this one you authenticate an app / service to use data catalog.

    https://docs.microsoft.com/en-us/rest/api/datacatalog/authenticate-to-data-catalog-service

    Monday, February 25, 2019 11:41 PM
  • Martin,

    Thank you. By any chance do you know if there is Python documentation?


    Tuesday, February 26, 2019 8:41 PM
  • Hi,

    Please have a look at the answer provided on the same issue raised by you on Stack Overflow (link). The answer on that should work for you.

    Source - Azure Samples .

    Hope this helps.


    MSDN

    Wednesday, February 27, 2019 10:51 AM
  • Hi Chirag,

    Thank you. The code provided in stack overflow was for web application which consists of CLIENT_SECRET. However, my application is a native application which doesn't have a CLIENT_SECRET. I used the similar code provided on Stackoverflow.

    authority_host_url = "https://login.microsoftonline.com"
    tenant = " "
    authority_url = authority_host_url + '/' + tenant
    client_id = " " 
    redirect = "https://login.live.com/oauth20_desktop.srf"
    RESOURCE = "https://management.core.windows.net/"

    context = adal.AuthenticationContext(authority_url)
    code = context.acquire_user_code(RESOURCE, client_id)
    #print(code['message'])
    mgmt_token = context.acquire_token_with_device_code(RESOURCE, code, client_id)
    armCreds = AADTokenCredentials(mgmt_token, client_id, resource = RESOURCE)

    When I used the above code, It is redirecting me to the exact data catalog that I would like to access. But, it doesn't allow me to log in displaying the following error even though I had all the permissions to the resource.

    AADSTS650057: Invalid resource. The client has requested access to a resource which is not listed in the requested permissions in the client's application registration.

    Thursday, March 7, 2019 8:13 PM
  • Hi there,

    Since the resource you are trying is a management API, I don't think you can access it with a native app directly without prompting for authentication. Something like this :

    // Call AcquireToken to get an Azure token from Azure Active Directory token issuance endpoint
                    //  AcquireToken takes a Client Id that Azure AD creates when you register your client app.
                    authResult = await authContext.AcquireTokenAsync(resourceUri, clientId, new Uri(redirectUri), new PlatformParameters(PromptBehavior.Always));
               

    Had it been a web app, you could have used its clientId with AAD to give it access to the Data Catalog as suggested in the Stack Overflow post that I suggested.


    MSDN

    Tuesday, March 12, 2019 8:57 AM
  • Hi,

     I am running into same issues like this. Could please guide on how to connect to Azure data catalog glossary items using REST API in Python?. Could you please guide on where to start? I added a new application in Azure Active directory. but unsure on what to create with it?. Should it be native or web app? I only want to add files from excel into glossary of the Azure data catalog. Please help on this regard?

    Thursday, June 6, 2019 10:41 PM
  • Hi,

      Could please guide on how to connect to Azure data catalog glossary items using REST API in Python?. Could you please guide on where to start? I added a new application in Azure Active directory. but unsure on what to create with it?. Should it be native or web app? I only want to add files from excel into glossary of the Azure data catalog. Please help on this regard?. How would I know which to use?.

    Thursday, June 6, 2019 10:42 PM