Hello Camel Beck,
Thank you for posting your query here!
Azure SFTP service is a cloud-based solution that allows you to transfer files securely over SSH File Transfer Protocol (SFTP). You can use any SFTP client to connect to the service, including curl command.
curl is a command-line tool that can be used to send and receive files over various protocols, including SFTP. To use curl with Azure SFTP service, you need to provide the following information:
· The URL of the Azure SFTP service endpoint, which has the format sftp:// @ -sftp.azurewebsites.net
· The password or the SSH key for authentication
· The local file path or the remote file path for the file transfer
Here are some examples of using curl with Azure SFTP service:
You can also make use of the curl command to upload to the Azure Storage Account from Linux. We need to follow the below command for the upload operation.
curl -u "<Account Name>.<Local User Name>:<SSH-Key>" -k "sftp://<Account Name>-sftp.azurewebsites.net/test.txt" -o test.txt
Here, parameter “T” stands for the file path on your local machine that you want to upload to the storage account. Adding the correct parameter, the above commands become as:
curl -T /home/shxxx/sample.yaml -u "<Account Name>.<Local User Name>:<SSH-Key> " -k "sftp:/<Account Name>.blob.core.windows.net/~/sample.yaml"
Below is an example of using curl
to download a file named test.txt
from the root directory of the Azure SFTP service to the current directory:
curl -u "<Account Name>.<Local User Name>:<SSH-Key>" -k "sftp://<Account Name>-sftp.azurewebsites.net/test.txt" -o test.txt
Similar issue: https://github.com/curl/curl/issues/4041
Further reference: https://curl.se/docs/
Do let us know if you have any further queries. I’m happy to assist you further.
Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.