Azure Logic App Standard - Some of the connections are not authorized yet - azure-logic-apps

I'm creating a logic apps standard workflow hosted in an ase v3. I have the built-in file system connector to collect from an on-prem file share. I was able to create the workflow in the azure portal. However, when I return to it and click save I get the following message:
Some of the connections are not authorized yet. If you just created a
workflow from a template, please add the authorized connections to
your workflow before saving
The code for the workflow is shown below:
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Copy_file": {
"inputs": {
"parameters": {
"destination": "destination_path_here",
"source": "#triggerOutputs()?['body']?['path']"
},
"serviceProviderConfiguration": {
"connectionName": "FileSystem",
"operationId": "copyFile",
"serviceProviderId": "/serviceProviders/FileSystem"
}
},
"runAfter": {},
"type": "ServiceProvider"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"triggers": {
"When_a_file_is_added": {
"conditions": [
{
"expression": "#not(equals(triggerBody().Size,0))"
}
],
"inputs": {
"parameters": {
"folderPath": "source_path_here"
},
"serviceProviderConfiguration": {
"connectionName": "FileSystem",
"operationId": "whenFilesAreAdded",
"serviceProviderId": "/serviceProviders/FileSystem"
}
},
"kind": "Polling",
"recurrence": {
"frequency": "Second",
"interval": 15
},
"splitOn": "#triggerOutputs()?['body']",
"type": "ServiceProvider"
}
}
},
"kind": "Stateful"
}

Related

Queue Name is not binding to azure logic app after deployment

I am trying to deploy the Azure logic app to two environments ie. dev and prod.
I am using a single json file for the logic app and for the environments I have different parameter files. The Azure pipeline picks the parameter file as per the environment. All the parameters defined in the parameters files get bound during deployment, but I'm having issues with the queue name.
This is how I am defining parameters in the parameters files:
"parameters": {
"logicAppName": {
"value": "Test-App-dev"
},
"QueueName": { "value": "testdev" }
}
This is how it is used in path variable in logic app json file:
But after deployment, the queue name is not reflecting on the Azure portal. This is how it looks like in the Azure portal:
After reproducing from our end, we found that this is due to an invalid template. Here is how we could able to pull off the required value.
Created the below parameter
"parameters": {
........
,
"QueueName": {
"defaultValue": "testdev",
"type": "String"
}
}
Now you need to add the same in the template's parameter
"parameters": {
"$connections": {
"value": {
"servicebus_1": {
"connectionId": "[parameters('connections_servicebus_1_externalid')]",
"connectionName": "servicebus-1",
"id": "***"
}
}
},
"QueueNamedev": {
"value": "[parameters('QueueName')]"
}
}
Declare the same in your definition's parameter
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
},
"$QueueNamedev": {
"defaultValue": {},
"type": "String"
}
}
RESULT:
Finally, we could able to read its value as 'testdev'. You can check from parameters that the value of QueueNamedev is read as testdev.
Below is the template of my logic app
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"workflows_LogicApp12_name": {
"defaultValue": "LogicApp12",
"type": "String"
},
"connections_servicebus_1_externalid": {
"defaultValue": "/subscriptions/<YourSubscriptionID>/resourceGroups/<YourResourceGroup>/providers/Microsoft.Web/connections/servicebus-1",
"type": "String"
},
"QueueName": {
"defaultValue": "testdev",
"type": "String"
}
},
"variables": {},
"resources": [
{
"type": "Microsoft.Logic/workflows",
"apiVersion": "2017-07-01",
"name": "[parameters('workflows_LogicApp12_name')]",
"location": "centralus",
"properties": {
"state": "Enabled",
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
},
"QueueNamedev": {
"defaultValue": {},
"type": "String"
}
},
"triggers": {
"When_a_message_is_received_in_a_queue_(auto-complete)": {
"recurrence": {
"frequency": "Minute",
"interval": 3
},
"evaluatedRecurrence": {
"frequency": "Minute",
"interval": 3
},
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "#parameters('$connections')['servicebus_1']['connectionId']"
}
},
"method": "get",
"path": "/#{encodeURIComponent(encodeURIComponent(parameters('QueueNamedev')))}/messages/head",
"queries": {
"queueType": "Main"
}
}
}
},
"actions": {},
"outputs": {}
},
"parameters": {
"$connections": {
"value": {
"servicebus_1": {
"connectionId": "[parameters('connections_servicebus_1_externalid')]",
"connectionName": "servicebus-1",
"id": "/subscriptions/<YourSubscriptionID>/providers/Microsoft.Web/locations/centralus/managedApis/servicebus"
}
}
},
"QueueNamedev": {
"value": "[parameters('QueueName')]"
}
}
}
}
]
}

ARM template deployment for Logic Apps with Datalake API Connection

Error - The API connection 'azuredatalake' is not configured to support managed identity."
I tried deployment of Azure logic App along with API connection to access Azure DataLake Gen1 using Managed Identity. This failed due to above error.
Also deployed API connection separately which was successful but with status "Unauthenticated", so deploying of corresponding logic apps failed with missing api connection.
Part Template for API connection reference:
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[parameters('azuredatalake_1_Connection_Name')]",
"location": "[parameters('location')]",
"kind": "V1",
"properties": {
"displayName": "azuredatalakemsi",
"customParameterValues": {},
"api": {
"id": "[variables('managedadlsApi')]"
}
}
}
If we want to access the data stored in data lake gen1, we must configure right ACLs for the user or sp used to do auth. Otherwise, we cannot have permission to access data. For more details, please refer to the official document. Meanwhile, we cannot do that via arm template. We can do that by PowerShell or Portal.
Besides, regarding how to use MSI to access Azure data lake gen1 in azure logic app, please refer to the following steps
Enable MSI in Azure logic app
{
"apiVersion": "2016-06-01",
"type": "Microsoft.logic/workflows",
"name": "[variables('logicappName')]",
"location": "[resourceGroup().location]",
"identity": {
"type": "SystemAssigned"
},
"properties": {
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {},
"parameters": {},
"triggers": {},
"contentVersion": "1.0.0.0",
"outputs": {}
},
"parameters": {},
"dependsOn": []
}
Configure ACLs
Create connection
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[parameters('azuredatalake_1_Connection_Name')]",
"location": "[parameters('location')]",
"tags": {
"CreatedTime": "2021-05-24T03:11:28.9371899Z"
},
"kind": "V1",
"properties": {
"displayName": "test",
"customParameterValues": {},
"api": {
"id": "[concat(subscription().id,'/providers/Microsoft.Web/locations/', parameters('location'), '/managedApis/azuredatalake')]"
}
}
},
{
"type": "Microsoft.Logic/workflows",
"apiVersion": "2017-07-01",
"name": "[parameters('workflows_testlogic05_name')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.Web/connections', parameters('azuredatalake_1_Connection_Name'))]"
],
"properties": {
"state": "Enabled",
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
},
"actions": {
},
"outputs": {}
},
"parameters": {
"$connections": {
"value": {
"azuredatalake": {
"connectionId": "[resourceId('Microsoft.Web/connections', parameters('azuredatalake_1_Connection_Name'))]",
"connectionName": "azuredatalake",
"connectionProperties": {
"authentication": {
"type": "ManagedServiceIdentity"
}
},
"id": "[concat(subscription().id,'/providers/Microsoft.Web/locations/', parameters('location'), '/managedApis/azuredatalake')]"
}
}
}
}
}
}
For more details, please refer to
https://learn.microsoft.com/en-us/azure/logic-apps/create-managed-service-identity
I was able to solve this by modifying ARM Template for this API connection, that is by adding "parameterValueType" as "Alternative".
Deployment of Azure logic App along with API connection to access Azure DataLake Gen1 using Managed Identity is successful.
Part Template for API connection reference:
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[parameters('azuredatalake_1_Connection_Name')]",
"location": "[parameters('location')]",
"kind": "V1",
"properties": {
"displayName": "azuredatalakemsi",
"parameterValueType": "Alternative",
"customParameterValues": {},
"api": {
"id": "[variables('managedadlsApi')]"
}
}
}

Need help to understand maintaining azure key vault in different environment and also to be able to use that in logic app

I have a logic app which makes HTTP call to Key Vault URI to get the secret needed to connect to external system. I have developed this in the dev resource group. I want to know how to setup the key vault from dev resource groups to other resource groups (test/prod). Also, how to migrate the logic app and get the secret per environment.
:) The solution is to use ARM templates and ADO/any other pipeline. You can create ARM templates with different parameters' values for different environments and use them to deploy your Logic App and Key vault to different environments.
Logic App Template sample:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
// Template parameters
"parameters": {
"<template-parameter-name>": {
"type": "<parameter-type>",
"defaultValue": "<parameter-default-value>",
"metadata": {
"description": "<parameter-description>"
}
}
},
"variables": {},
"functions": [],
"resources": [
{
// Start logic app resource definition
"properties": {
<other-logic-app-resource-properties>,
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {<action-definitions>},
// Workflow definition parameters
"parameters": {
"<workflow-definition-parameter-name>": {
"type": "<parameter-type>",
"defaultValue": "<parameter-default-value>",
"metadata": {
"description": "<parameter-description>"
}
}
},
"triggers": {
"<trigger-name>": {
"type": "<trigger-type>",
"inputs": {
// Workflow definition parameter reference
"<attribute-name>": "#parameters('<workflow-definition-parameter-name')"
}
}
},
<...>
},
// Workflow definition parameter value
"parameters": {
"<workflow-definition-parameter-name>": {
"value": "[parameters('<template-parameter-name>')]"
}
},
"accessControl": {}
},
<other-logic-app-resource-definition-attributes>
}
// End logic app resource definition
],
"outputs": {}
}
Key Vault template:
{
"name": "string",
"type": "Microsoft.KeyVault/vaults",
"apiVersion": "2018-02-14",
"location": "string",
"tags": {},
"properties": {
"tenantId": "string",
"sku": {
"family": "A",
"name": "string"
},
"accessPolicies": [
{
"tenantId": "string",
"objectId": "string",
"applicationId": "string",
"permissions": {
"keys": [
"string"
],
"secrets": [
"string"
],
"certificates": [
"string"
],
"storage": [
"string"
]
}
}
],
"vaultUri": "string",
"enabledForDeployment": "boolean",
"enabledForDiskEncryption": "boolean",
"enabledForTemplateDeployment": "boolean",
"enableSoftDelete": "boolean",
"createMode": "string",
"enablePurgeProtection": "boolean",
"networkAcls": {
"bypass": "string",
"defaultAction": "string",
"ipRules": [
{
"value": "string"
}
],
"virtualNetworkRules": [
{
"id": "string"
}
]
}
},
"resources": []
}
Moreover, you can read this article to understand more about setting up your ADO pipelines: Integrate ARM templates with Azure Pipelines

How to add Blob storage connection in logic app template file

I want to deploy the logic app to the portal using the Azure cloud shell, I have modified the all the files , and able to deploy the logic apps successfully. But when I see the changes in the portal all the actions are showing but the blob storage part it is showing like invalid connection.
Please help us how to provide the connections and all related to the blob storage in the logic app template file.
Thanks in advance.
Regards, Manikanta P.
Let's assume i already have a container called azureBlobContainer under MyStorageAccount Using the below template you should be able to deploy a LogicApp with a blob connection created.
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"LogicAppName": {
"defaultValue": "Test",
"type": "string"
},
"storageAccountName": {
"defaultValue": "MyStorageAccount",
"type": "string"
}
},
"variables": {},
"resources": [
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "azureblobContainer",
"location": "[resourceGroup().location]",
"properties": {
"displayName": "BlobConnection",
"api": {
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/', 'azureblob')]"
},
"parameterValues": {
"accessKey": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).keys[0].value]",
"accountName": "[parameters('storageAccountName')]"
}
}
},
{
"type": "Microsoft.Logic/workflows",
"apiVersion": "2017-07-01",
"name": "[parameters('LogicAppName')]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Web/connections', 'azureblobContainer')]"
],
"properties": {
"state": "Enabled",
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"request": {
"type": "Request",
"kind": "Http",
"inputs": {
"schema": {}
}
}
},
"actions": {
"Create_blob": {
"runAfter": {},
"type": "ApiConnection",
"inputs": {
"body": "#triggerBody()",
"host": {
"connection": {
"name": "#parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "post",
"path": "/datasets/default/files",
"queries": {
"folderPath": "/azureblobContainer",
"name": "Test",
"queryParametersSingleEncoded": true
}
},
"runtimeConfiguration": {
"contentTransfer": {
"transferMode": "Chunked"
}
}
},
"Response": {
"runAfter": {
"Create_blob": [
"Succeeded"
]
},
"type": "Response",
"inputs": {
"statusCode": 200
}
}
},
"outputs": {}
},
"parameters": {
"$connections": {
"value": {
"azureblob": {
"connectionId": "[resourceId('Microsoft.Web/connections', 'azureblobContainer')]",
"connectionName": "azureblobContainer",
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/', 'azureblob')]"
}
}
}
}
}
}
]
}

How to stop Azure Logic App SMS flooding?

I am trying to use this Azure Serverless IOT Button Project to send an SMS alert: https://azure.microsoft.com/en-in/resources/samples/azure-serverless-iot-button/
When I click the button once, I see that the Logic App starts running multiple times and I get flooded with hundreds of SMS messages in less than a minute. I only need one SMS alert per button click. What am I missing?
"$connections": {
"value": {
"plivo": {
"connectionId": "/subscriptions/---0-fb3c-406e-98--2-7fa0e00ef0d0/resourceGroups/--/providers/Microsoft.Web/connections/plivo",
"connectionName": "plivo",
"id": "/subscriptions/f--0-fb3c-406e-9-72-7f--0/providers/Microsoft.Web/locations/westus/managedApis/plivo"
}
}
},
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Send_SMS": {
"inputs": {
"body": {
"dst": "1 801-999-9999",
"src": "1 801-999-9982",
"text": "Button Pressed - #{triggerBody()?['location']}"
},
"host": {
"connection": {
"name": "#parameters('$connections')['plivo']['connectionId']"
}
},
"method": "post",
"path": "/v1/Account/auth_id_value/Message/"
},
"runAfter": {},
"type": "ApiConnection"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"manual": {
"inputs": {
"schema": {
"properties": {
"location": {
"type": "string"
}
},
"type": "object"
}
},
"kind": "Http",
"type": "Request"
}
}
}
}
You have tagged this question with azure-function-app, are you sure the azure function only calls the logic app one time? Could you please post the code of the azure function
I apparently wasnt filtering the messages that were coming through, and so it was triggering on other telemetry that had nothing to do with the buttons.

Resources