1

我想使用 Azure 云外壳将逻辑应用部署到门户,我已经修改了所有文件,并且能够成功部署逻辑应用。但是当我看到门户中的更改时,所有操作都在显示,但 blob 存储部分显示为无效连接。

请帮助我们如何在逻辑应用模板文件中提供与 Blob 存储相关的连接和所有内容。

提前致谢。

问候, Manikanta P.

4

1 回答 1

1

假设我已经在使用下面的模板azureBlobContainer下调用了一个容器MyStorageAccount,您应该能够部署一个创建了 blob 连接的 LogicApp。

{
    "$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')]"
                            }
                        }
                    }
                }
            }
        }
    ]
}

在此处输入图像描述

于 2019-07-25T09:43:59.740 回答