jsonazuredynamic-content

converting dynamic content to JSON


I'm building a pipeline who sends a secret to the rest API of Azure key-vault with the Azure data factory tool (https://learn.microsoft.com/en-us/rest/api/keyvault/secrets/set-secret/set-secret). If I set the secret hardcoded then it works fine but if I replace it with my dynamic content variable it gives a newline error. Does anyone has a solution for this problem? click here for an image of the error

The working code:

{
"values": "test"
}

the not working code:

{
"values": @variables('push_refresh_token')
}

Solution

  • Thank you @AnnuKumari-MSFT & @KoenVerschuren-6858 Posting your solutions as answer in community wiki to beneficial other community members for the similar issue.

    Here is the workaround from MS Q&A:-

    We need to add quotes to the variable with concatenate:- For example:-

    To set variable:

    @concat('"', string(activity('get_auth_code').output.refresh_token),'"')
    

    which is followed by in web;

    @concat('{"value":', variables('push_refresh_token'),'}')