Home > Blockchain >  Forbidden Error When JSON From A File Imported Using Azure CLI
Forbidden Error When JSON From A File Imported Using Azure CLI

Time:01-03

I am trying to import contents of a JSON file using Azure CLI and I am continuously getting forbidden error as shown in the snapshot given below. Any pointers / suggestions would be appreciated.

enter image description here

I used the command given below. The command is straight forward and shown in the code snippet given below.

az appconfig kv import -s file --format json --path "./settings.json"
    --content-type "application/json"
    --separator :
    --depth 2 
    --connection-string "{app-config-connection-string}"

CodePudding user response:

After spending some time, I found something.
If a read-only connection string is used, then you will get the "forbidden" error as shown in the snapshot in the question.

We need to use read-write connection string and then, it should work as expected.

az appconfig kv import -s file --format json --path "./settings.json"
    --content-type "application/json"
    --separator :
    --depth 2 
    --connection-string "{app-config-read-write-connection-string}"

If you are using --name instead of --connection-string switch, then make sure that you have appropriate permissions for writing to the Azure App Configuration store.

  • Related