I'm working on integrating Azure Purview with other systems usingPowerShell. My goal is to fetch a list of all glossary terms from Azure Purview programmatically using the REST API and PowerShell.
Here's what I've tried so far:
Authentication and Token Retrieval: I have successfully authenticated with Azure using PowerShell and obtained a valid bearer token for Azure Purview using the following script:
# Define Azure Purview details$resourceGroupName = "ResourceGroupName"$purviewAccountName = "PurviewAccountName"# Authenticate and get access tokenConnect-AzAccount$token = Get-AzAccessToken -ResourceUrl "https://purview.azure.net" |Select-Object -ExpandProperty AccessToken
Attempt to Retrieve Glossary Terms: I attempted to use the following PowerShell script to fetch glossary terms but encountered issues:
# Define Azure Purview API endpoint for glossary terms$glossaryId = "" #Where to get it?????$endpoint = "https://$purviewAccountName.purview.azure.com/datamap/api/atlas/v2/glossary/$glossaryId/terms?api-version=2023-09-01&limit=-1&offset=0&sort=ASC"# Set headers with the access token$headers = @{'Authorization' = "Bearer $token"'Content-Type' = 'application/json'}# Make the GET requesttry { $response = Invoke-RestMethod -Uri $endpoint -Headers $headers -Method Get $response}catch { Write-Error "Failed to retrieve glossary terms. Error: $_"}
The above script resulted in errors like "Not found" and did not retrieve the expected glossary terms. I've seen examples using other endpoints or parameters like keywords in the API documentation, but I'm unsure of the correct approach for glossary terms.
Could someone provide guidance on the correct PowerShell syntax and parameters to retrieve glossary terms from Azure Purview via the REST API?
Any assistance, examples, or insights into how to structure the API request correctly would be greatly appreciated.