Piyush Gandhi
Piyush Gandhi

Reputation: 1

How can I get the variable list and their value using azure connection string?

I have a azure connection string Endpoint=https://******.azconfig.io;Id=******;Secret=******.

I would like to fetch and print (write in a file) all the variables using above string. Is there an API/ way to acheive this?

I looked for many solution. could not find anythingg.

Upvotes: 0

Views: 309

Answers (1)

Harshitha
Harshitha

Reputation: 7392

To get key-values from App Configuration store via REST API, you can check below steps:

  • Register one Azure AD application and grant API permissions for the Azure App Configuration API as below:

enter image description here

  • Now, generate bearer token using delegated flows like authorization code flow, username password etc…

I have taken references from the MSDoc - Azure App Configuration REST API - key-value.

  • In my case, I have used username password flow to generate bearer token via Postman like this:
POST https://login.microsoftonline.com/<tenantID>/oauth2/token
grant_type:password
client_id:<appID>
client_secret:<secret>
resource: https://azconfig.io
username: [email protected]
password: xxxxxxxxx

Response:

enter image description here

Now, use this token to call below REST API:

GET https://<appconfig_name>.azconfig.io/kv/?&api-version=1.0
Authorization: Bearer <token_from_above_Step>

Response:

enter image description here

Using the Azure CLI command.

I have taken reference from the MSDoc to retrieve the list.

 az appconfig kv list --endpoint Endpoint="https://sriapp.azconfig.io;Id=E6eW;Secret=**********=" --auth-mode key --name sriapp

Output:

enter image description here

Upvotes: 0

Related Questions