setting up azure sftp and python script to upload files

preview_player
Показать описание
This is a 3 part series explaining everything in simple and easy 25 steps.
I'm a best practioner to keep the enviornment safe and clean,
that added certain additional steps at the end that gave birth to part 3,
and hope you can bear with me considering the costs and benefits.

Part 1 - setting up azure sftp

2. create testRG
3. create storage a/c - sftsademo
4. LRS
5. Enable hierarchical namespace, checkbox
6. Enable SFT preview
7. wait and when finished click on goto resources button
8. click on containers
9. click on +Container
10. name: testcontainer
11. add folder public
12. SFT preview
13. Add user
14. copy SSH password
15. note down username, connection string

...

16. test connection with winscp

Part 2: file upload with python script

1. make sure you have VS Code and latest python installed
2. create a folder sftp demo
3, cd sftdemo
4. pip install pysftp
5. code .
7. copy the code below

import pysftp

FTP_HOST = "..."
FTP_USER = "..."
FTP_PASS = "..."

class UploadToFtp:
def __init__(self, folder, export_file):
try:
cnopts = pysftp.CnOpts()
with pysftp.Connection(
host = FTP_HOST,
username = FTP_USER,
password = FTP_PASS,
cnopts = cnopts) as sftp:
print("Connection succesfully stablished ... ")
except Exception as ex:
print(ex)

8. make necessay changes to the code
9. Test your code

Part 3: cleanup azure and keep enviornment safe

Always dispose things that you don't need to keep the world slim, clean and safe

1. click on Home
2. click on testRG
3. CLICK ON 'Delete resource group'

Hope you enjoyed my video!
please do subscribe so that you get notified when I release a new video

Thanks, Adi
Рекомендации по теме
Комментарии
Автор

Please let me know the example of the host name here.

truongviet
Автор

When you are talking about testing sftp and looking into the windows folders. The correct screen is not visible. It seems you have choose the selective share and started sharing the azure UI on browser and then didn't change the screen shared to the folders or the desktop.

lovepreetbagga
Автор

When you are talking about testing sftp and looking into the windows folders. The correct screen is not visible. It seems you have choose the selective share and started sharing the azure UI on browser and then didn't change the screen shared to the folders or the desktop.

Ganesh-em
join shbcf.ru