PowerShell:从Azure Blob存储运行Python脚本 [英] PowerShell: run Python script from Azure blob storage

查看:71
本文介绍了PowerShell:从Azure Blob存储运行Python脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是刚使用PowerShell的人,我要做的就是创建一个.ps1文件,我可以执行该文件,然后从Azure存储帐户中的blob存储执行python脚本.

I am brand new to using PowerShell and all I want to do is create a .ps1 file that I can execute which then executes a python script from blob storage in my Azure storage account.

我认为正常的执行命令就是:

I think the normal execution command would simply be:

C:/test.py

或者然后设置路径:

python test.py

???

但是我该如何执行存储在blob中的脚本,例如:

But how do I do this to execute a script stored in a blob at say:

https://StorageName.blob.core.windows.net/testing/testblob/test.py

?

我可以将该命令另存为.ps1吗?当我执行.ps1时,它将启动Python脚本吗?

And can I just save that command as a .ps1 which will kickoff the Python script when I execute the .ps1?

谢谢!

推荐答案

您首先需要将python脚本从Blob下载到本地存储(local = VM,Web/Worker角色实例,网站实例,笔记本电脑) ...).然后,一旦下载,就可以运行它.

You'd first need to download your python script from your blob to local storage (whether local = VM, web/worker role instance, website instance, your laptop...). Then, once it's downloaded, you can run it.

并且由于使用的是PowerShell:如果安装Azure PowerShell cmdlet,则可以使用Get-AzureStorageBlobContent从blob下载文件:

And since you're using PowerShell: If you install the Azure PowerShell cmdlets, you can download the file from blob, using Get-AzureStorageBlobContent:

Get-AzureStorageBlobContent -Container containername -Blob blobname -Destination localFolder

有关Get-AzureStorageBlobContent的更多信息,请此处.

这篇关于PowerShell:从Azure Blob存储运行Python脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆