New-AzApiManagementBackendCredential to create ref to named value #19075
-
I have a named value that contains a link to a key vault secret containing a function key. I'd like to create an apim backend with an authorization credential with a "x-funcions-key" header that pulls it's value from the key vault secret via the named value. In the portal, it would look like this: I have tried the following code:
This executes ok but rather than the resulting auth header value containing a reference to the named value, it simply contains a string of the name of the named value. Anyone know how to fix this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@RobBowman We sincerely apologies for the delay in getting back. Please try this. $context = New-AzApiManagementContext -ResourceGroupName "Issue19075" -ServiceName "Issue19075" $nvFuncKey = Get-AzApiManagementNamedValue -Context $context -Name "issue19075nvfromkv" $credential = New-AzApiManagementBackendCredential -Header @{"x-functions-key" = @("{{" + $nvFuncKey.Name + "}}")} $backend = New-AzApiManagementBackend -Context $context -BackendId 123 -Url 'https://contoso.com/awesomeapi' -Protocol http -Title "first backend" -SkipCertificateChainValidation $true -Credential $credential -Description "my backend" |
Beta Was this translation helpful? Give feedback.
@RobBowman We sincerely apologies for the delay in getting back.
Please try this.
$context = New-AzApiManagementContext -ResourceGroupName "Issue19075" -ServiceName "Issue19075"
$nvFuncKey = Get-AzApiManagementNamedValue -Context $context -Name "issue19075nvfromkv"
$credential = New-AzApiManagementBackendCredential -Header @{"x-functions-key" = @("{{" + $nvFuncKey.Name + "}}")}
$backend = New-AzApiManagementBackend -Context $context -BackendId 123 -Url 'https://contoso.com/awesomeapi' -Protocol http -Title "first backend" -SkipCertificateChainValidation $true -Credential $credential -Description "my backend"