M0rty
M0rty

Reputation: 1085

Deploy Logic App to different Azure subscriptions

I currently have two azure subscriptions setup, one for DEV and one for TEST. I have created a Logic App through Visual Studio, the issue I am having is that when I open the Logic App designer I must link the Logic App to a Subscription and Resource Group:

enter image description here

If I link it to the DEV subscription then this obviously prevents me from deploying the logic app to the TEST subscription. Does this mean I will have to create an identical Logic App for Test or am I going about this the wrong way?

Upvotes: 0

Views: 1808

Answers (3)

TheNerdyNerd
TheNerdyNerd

Reputation: 274

Something that worked for me would be to go to code view and copy the json.

Take note though by copying your connections and subscription references these could cause issues on the new location that you are pointing to especially if you are going across organisations.

Steps are:

Logic Apps --> Edit --> Code view - copy the source logic app Edit Logic app

code view

Login to the new subscription or org

Logic Apps --> New blank logic app --> Edit --> Code view and paste - try saving. If you are moving subscription/org likely that any references to APIs or API connections will fail as well as SQL references.

I would recommend in that instance create another plain logic app and add connections via that app first with ideally the same or similar names.

Go into the code view as above and scroll right to the bottom of this plain logic app and check the reference and copy the Ids and connection Ids:

Showing something like:

"connectionId": "/subscriptions/xxxxxx/resourceGroups/xxxxxx/providers/Microsoft.Web/connections/sql",    
"connectionName": "sql",
"id": "/subscriptions/xxxxxx/providers/Microsoft.Web/locations/uksouth/managedApis/sql"

This is where you would need to update reference to the right subscriptions and orgs that you had on a working logic app.

Upvotes: 0

M0rty
M0rty

Reputation: 1085

I ended up finding a solution. The underlying problem was that inside my Logic App I was using a Function App connector that connected directly to a Function inside one of my subscriptions so when I tried to deploy the Logic App to another subscription it failed due to that Function already being linked to another subscription. I managed to paramterize the function Id so that I can deploy to any Subscription.

"function": { "id": "[resourceId('Microsoft.Web/sites/functions', parameters('functionAppName'), variables('functionName'))]" }

Upvotes: 1

George Chen
George Chen

Reputation: 14344

Actually the linked subscription doesn't matter the deployment, if you have finished the building of Logic Apps, you could choose different accounts, subscriptions and resource groups to deploy.

enter image description here

enter image description here

Cause it uses .ps1 file to deploy the LogicApp.json it's same as the template deployment.

And about the function in Logic Apps, you couldn't just add the Function. You have to use the HTTP trigger function then use HTTP request in the Logic Apps. For description, you could refer to this doc and this tutorial.

Upvotes: 0

Related Questions