ApiConnections in local development scenarios with vscode #905
-
Hi, i use Standard Logic Apps to implement a cloud native lowcode solution and have a relative simple question, but don't found a real good explanation in microsoft docs: How could i create(transform) the managed Api Connection which use an app service(WebApp with a swagger api) in azure to use this for local development in vscode.
My connections.json in azure looks like:
I found in the documentation it is possible to use the authentication type "Raw", but it fails because i couldn't found the right settings for local development.
In addition, i couldn't found a reference for the connections.json file in MS documentation. And my Custom Api in azure use a apikey for authentication, which is defined in the ApiConnection in azure. How could this ApiConnection transfrom to use it for local development? Any help is appreciated. Thx in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @rayburks, in a local development environment you can set the The managed connection configuration that is committed into your Git repo should use Information about how to use Before you deploy a Logic App to an Azure environment you need to change the There are different ways that you can do this. I prefer automating it as part of a DevOps build pipeline so that (i) developers don't have to worry about it and (ii) the build output that is generated by the build pipeline is configured ready for a deployment pipeline that deploys the workflows (and related configuration) to the Logic App resource in Azure. You can write a simply PowerShell script that manipulates the I use something like this: param(
[Parameter(Mandatory=$True)]
[string]
$logicAppFolderPath
)
$ErrorActionPreference = 'Stop'
# Get the connections file
$connectionsFilePath = [IO.Path]::Combine($logicAppFolderPath, 'connections.json')
Write-Host "Updating connections file: $connectionsFilePath"
$json = Get-Content -Path $connectionsFilePath | ConvertFrom-Json
If ([bool]($json.PSobject.Properties.name -match "managedApiConnections") -eq $false)
{
return
}
# For each Managed API connection
$json.managedApiConnections.PsObject.Properties.Value | ForEach-Object {
# Replace with Managed Service Identity authentication
If ([bool]($_.authentication.PSObject.Properties.name -match "type") -eq $true) {
$_.authentication.type = "ManagedServiceIdentity"
}
# Remove any unnecessary properties relating to 'raw' authentication
If ([bool]($_.authentication.PSObject.Properties.name -match "audience") -eq $true) {
$_.authentication.PSObject.Properties.Remove('audience')
}
If ([bool]($_.authentication.PSObject.Properties.name -match "credentialType") -eq $true) {
$_.authentication.PSObject.Properties.Remove('credentialType')
}
If ([bool]($_.authentication.PSObject.Properties.name -match "clientId") -eq $true) {
$_.authentication.PSObject.Properties.Remove('clientId')
}
If ([bool]($_.authentication.PSObject.Properties.name -match "tenant") -eq $true) {
$_.authentication.PSObject.Properties.Remove('tenant')
}
If ([bool]($_.authentication.PSObject.Properties.name -match "secret") -eq $true) {
$_.authentication.PSObject.Properties.Remove('secret')
}
If ([bool]($_.authentication.PSObject.Properties.name -match "scheme") -eq $true) {
$_.authentication.PSObject.Properties.Remove('scheme')
}
If ([bool]($_.authentication.PSObject.Properties.name -match "parameter") -eq $true) {
$_.authentication.PSObject.Properties.Remove('parameter')
}
}
# Write the updated content
Remove-Item -Path $connectionsFilePath -Force -Recurse
$json | ConvertTo-Json -Depth 20 | Out-File ( New-Item -Path $connectionsFilePath -Force ) Mike Stephenson has also created a good video about Managed API connectors and the associated DevOps processes, check it out here. He takes a similar appraoch and uses a similar PowerShell file. |
Beta Was this translation helpful? Give feedback.
-
@rayburks , please remember to close this discussion as resolved if you are happy with my response. |
Beta Was this translation helpful? Give feedback.
@rayburks , please remember to close this discussion as resolved if you are happy with my response.