I am trying to write a bicep part for an Azure Logic App API connection to an Azure AI Document Intelligence instance. This connection can be made with type formrecognizer
.
I have searched the web to find how the bicep file should be written, but everthing I've tried failed so far. Even Co-pilot had no answer that worked. This is what I have:
resource documentIntelligenceConnection 'Microsoft.Web/connections@2016-06-01' = {
name: documentIntelligenceConnectionName
location: location
kind: 'V1'
properties: {
displayName: documentIntelligence.name
api: {
id: subscriptionResourceId('Microsoft.Web/locations/managedApis', location, 'formrecognizer')
}
nonSecretParameterValues: {
siteUrl: documentIntelligence.properties.endpoint
}
parameterValues: {
apiKey: documentIntelligence.listKeys().key1
}
}
}
But this doesn't work:
parameterValues: {
apiKey: documentIntelligence.listKeys().key1
}
or this
parameterValues: {
sharedKey: documentIntelligence.listKeys().key1
}
or this
parameterValues: {
accountKey: documentIntelligence.listKeys().key1
}
or this
secureParameterValues: {
sharedKey: documentIntelligence.listKeys().key1
}
or this
parameterValues: {
auth: {
type: 'ApiKey'
apiKey: documentIntelligence.listKeys().key1
}
}
Does anyone know the correct way to add the apikey with bicep to a formrecognizer API connection?
Easiest way to figure this out is to open developer tools in your browser, create the connection manually and look at the request sent from the portal in the network tab. This worked for me:
resource documentIntelligenceConnection 'Microsoft.Web/connections@2016-06-01' = {
name: documentIntelligenceConnectionName
location: location
kind: 'V1'
properties: {
displayName: documentIntelligence.name
api: {
id: subscriptionResourceId('Microsoft.Web/locations/managedApis', location, 'formrecognizer')
}
parameterValues: {
api_key: documentIntelligence.listKeys().key1
siteUrl: documentIntelligence.properties.endpoint
}
}
}