Azure Blob复制和删除

时间:2019-07-10 18:00:51

标签: azure

我正在将一个Azure Blob文件从一个Blob存储帐户复制到另一个帐户。我已经完成了这部分的工作,但是要求是从第一个Blob存储帐户中删除Blob文件。

我已将文件放入数组变量,并在数组上执行“ for each”循环以获取文件,然后将其删除。我得到的错误是:

"status": 400,
  "message": "The specified resource name length is not within the permissible limits.\r\nclientRequestId: 1e7ab499-56f5-4cd9-98c6-13738af47911",
"source": "azureblob-cus.azconn-cus.p.azurewebsites.net"


"$connections": {
    "value": {
        "azureblob": {
            "connectionId": ".../Microsoft.Web/connections/azureblob",
            "connectionName": "azureblob",
            "id": "...Microsoft.Web/locations/centralus/managedApis/azureblob"
        }
    }
},
"definition": {
    "$schema": ".../schemas/2016-06-01/workflowdefinition.json#",
    "actions": {
        "Copy_blob": {
            "inputs": {
                "host": {
                    "connection": {
                        "name": "@parameters('$connections')['azureblob']['connectionId']"
                    }
                },
                "method": "post",
                "path": "/datasets/default/copyFile",
                "queries": {
                    "destination": "/blobtwo",
                    "overwrite": false,
                    "queryParametersSingleEncoded": true,
                    "source": "@triggerBody()?['Path']"
                }
            },
            "runAfter": {
                "For_each_2": [
                    "Succeeded"
                ]
            },
            "type": "ApiConnection"
        },
        "For_each": {
            "actions": {
                "Delete_blob1": {
                    "inputs": {
                        "host": {
                            "connection": {
                                "name": "@parameters('$connections')['azureblob']['connectionId']"
                            }
                        },
                        "method": "delete",
                        "path": "/datasets/default/files/@{encodeURIComponent(encodeURIComponent(items('For_each')))}"
                    },
                    "runAfter": {},
                    "type": "ApiConnection"
                }
            },
            "foreach": "@variables('BlobArray')",
            "runAfter": {
                "Copy_blob": [
                    "Succeeded"
                ]
            },
            "type": "Foreach"
        },
        "For_each_2": {
            "actions": {
                "Append_to_array_variable": {
                    "inputs": {
                        "name": "BlobArray",
                        "value": "@items('For_each_2')"
                    },
                    "runAfter": {},
                    "type": "AppendToArrayVariable"
                }
            },
            "foreach": "@body('List_blobs')?['value']",
            "runAfter": {
                "Initialize_variable": [
                    "Succeeded"
                ]
            },
            "type": "Foreach"
        },
        "Initialize_variable": {
            "inputs": {
                "variables": [
                    {
                        "name": "BlobArray",
                        "type": "Array"
                    }
                ]
            },
            "runAfter": {
                "List_blobs": [
                    "Succeeded"
                ]
            },
            "type": "InitializeVariable"
        },
        "List_blobs": {
            "inputs": {
                "host": {
                    "connection": {
                        "name": "@parameters('$connections')['azureblob']['connectionId']"
                    }
                },
                "method": "get",
                "path": "/datasets/default/foldersV2/@{encodeURIComponent(encodeURIComponent('/blobone'))}",
                "queries": {
                    "useFlatListing": false
                }
            },
            "metadata": {
                "JTJmYmxvYm9uZQ==": "/blobone"
            },
            "runAfter": {},
            "type": "ApiConnection"
        }
    },
    "contentVersion": "1.0.0.0",
    "outputs": {},
    "parameters": {
        "$connections": {
            "defaultValue": {},
            "type": "Object"
        }
    },
    "triggers": {
        "When_a_blob_is_added_or_modified_(properties_only)": {
            "inputs": {
                "host": {
                    "connection": {
                        "name": "@parameters('$connections')['azureblob']['connectionId']"
                    }
                },
                "method": "get",
                "path": "/datasets/default/triggers/batch/onupdatedfile",
                "queries": {
                    "folderId": "JTJmYmxvYm9uZQ==",
                    "maxFileCount": 10
                }
            },
            "metadata": {
                "JTJmYmxvYm9uZQ==": "/blobone"
            },
            "recurrence": {
                "frequency": "Minute",
                "interval": 3
            },
            "splitOn": "@triggerBody()",
            "type": "ApiConnection"
        }
    }
}

我不明白错误告诉我什么。 foreach返回我要删除的Blob,但是删除不起作用。我是天青人,还想了解变量,所以请原谅我的无知。

杰夫

0 个答案:

没有答案
相关问题