问题
I was experiencing a problem with a logic app which
Used the Create SAS URI by path action to get a SAS-enabled URL for a blob in a storage account
Used the SFTP copy file action to copy the file to an SFTP connector
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"
}
}
回答1:
This bug has been fixed in SFTP connector. To make it work, please create a new logic app with appropriate actions.
回答2:
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')}"
I'd report this to Microsoft, but can't find the Github repo for the connector. Hope this helps someone else in the future.
来源:https://stackoverflow.com/questions/48212364/azure-logic-apps-sftp-copy-file-action-breaks-with-some-sas-urls