Azure逻辑应用程序SFTP复制文件操作因某些SAS Urls而中断 [英] Azure logic apps SFTP Copy File action breaks with some SAS Urls
问题描述
我遇到了一个逻辑应用程序
I was experiencing a problem with a logic app which
-
使用按路径创建SAS URI 为存储帐户中的Blob获取启用SAS的URL的操作
Used the Create SAS URI by path action to get a SAS-enabled URL for a blob in a storage account
使用了SFTP副本 将文件复制到SFTP连接器的文件操作
Used the SFTP copy file action to copy the file to an SFTP connector
当尝试从存储中获取Blob时,该过程将大约50%的时间失败,并出现授权错误.
The process would fail roughly 50% of the time with an authorization error when trying to fetch the blob from storage.
"actions": {
"Create_SAS_URI_by_path": {
"inputs": {
"body": {
"Permissions": "Read"
},
"host": {
"connection": {
"name": "@parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "post",
"path": "/datasets/default/CreateSharedLinkByPath",
"queries": {
"path": "/container-name/SomeSourceFile.csv"
}
},
"runAfter": {},
"type": "ApiConnection"
},
"Copy_file": {
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['sftp']['connectionId']"
}
},
"method": "post",
"path": "/datasets/default/copyFile",
"queries": {
"destination": "testing-if-works.csv",
"overwrite": true,
"source": "@{body('Create_SAS_URI_by_path')?['WebUrl']}"
}
},
"runAfter": {
"Create_SAS_URI_by_path": [
"Succeeded"
]
},
"type": "ApiConnection"
}
}
推荐答案
如果SAS Url的签名中带有加号(%2B),则SFTP连接器存在一个错误,导致其失败,可能是由于连接器的方式尝试通过Url获取Blob时,代码将处理URL.解决方法是对加号进行双重编码:
The SFTP connector has a bug which causes it to fail if a SAS Url has a plus sign (%2B) in the signature, presumably due to how the connector code handles the URL when it tries to GET the blob by Url. The fix is to double-encode the plus sign:
"source": "@{replace(body('Create_SAS_URI_by_path')?['WebUrl'], '%2B', '%252B')}"
我已将此报告给Microsoft,但找不到该连接器的Github存储库.希望这对以后的人有所帮助.
I'd report this to Microsoft, but can't find the Github repo for the connector. Hope this helps someone else in the future.
这篇关于Azure逻辑应用程序SFTP复制文件操作因某些SAS Urls而中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!