Azure   发布时间:2019-11-03  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了PowerShell 操作 Azure Blob Storage大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

便查看 PowerSHell 代码执行的结果,本文使用了 MS 发布的一个 Azure Storage 客户端工具:https://azure.microsoft.com/en-us/features/storage-explorer/" target="_blank">Microsoft Azure Storage Explorer,文中简称为 Storage Explorer。

Hell Azure 模块

Hell 一起安装的,使用前需要单独的安装。

HellGet 模块Hell Gallery 安装 Azure 模块,需要确保已经安装了 PowerSHellGet 模块。下面的命令检查已安装 PowerSHellGet 模块的版本:

Get-Module PowerSHellGet -list | SELEct-Object Name,Version,Path

title="PowerSHell 操作 Azure Blob Storage" alt="PowerSHell 操作 Azure Blob Storage" src="https://cn.js-code.com/res/2019/02-09/09/9159d0acf1267637ed33d84c1a552be5.png" >

Hell 模块resource Manager 模块:

Install-Module AzureRM -AllowClobber

9382@有确认安装的交互过程。

Import-Module AzureRM

ntext 命令创建一个 AzureStorageContext 类型的对象,这个对象中包含了认证信息,所以接下来所有对 storage 的访问操作都需要使用它:

= New-AzureStorageContext -ConnectionString https;AccountName=youraccountname;AccountKey=youraccesskey;

String 选项,还可以把参数分开来写

= = = New-AzureStorageContext -StorageAccountName -StorageAccountKey -Protocol https

https 是非常重要的,因为以 https 协议上传下载的数据默认会进行数据的完整性校验。也就是说在进行文件的上传或者下载时,我们不需要再做额外的数据完整性校验了。

ntext 命令,还有其他的方式可以获得 AzureStorageContext 对象。比如可以先通过 Login-AzureRmAccount 登录,然后找到某个(或者是创建一个) Storage Account,并获取其 Context 属性。

= -AzureStorageContainer -Name -Permission Off -Context

Container:匿名用户可以访问文件内容,并且可以枚举 Container 中的所有文件。Blob:匿名用户可以访问文件内容,但是不能枚举 container 中的文件。Off:匿名用户不能访问文件。ntext 选项指定该命令的执行上下文,主要是认证信息,这里我们使用前面生成的对象 $ctx。

Set-AzureStorageBlobContent -Container -Blob -Context

title="PowerSHell 操作 Azure Blob Storage" alt="PowerSHell 操作 Azure Blob Storage" src="https://cn.js-code.com/res/2019/02-09/09/64ee4277fdce3f701a8638cc508ee282.png" >

Set-AzureStorageBlobContent -Container -Blob -Context

Get-ChildItem -Path -Recurse | Set-AzureStorageBlobContent -Container -Context

Set-AzureStorageBlobContent -Container -Blob -Context -Force

你知道某个 blob 对象的名称:

= -AzureStorageBlobContent -DesTination -Container -Blob -Context -Force

= = Get-AzureStorageBlob -Container -Context ( { (.Name.Contains({ Get-AzureStorageBlobContent -DesTination -Container -Blob .Name -Context -

用这个命令的方式!下面的命令在同一个 Container 中执行文件复制操作:

Start-AzureStorageBlobCopy -SrcBlob -SrcContainer -DestContainer -DestBlob -Context

= Start-AzureStorageBlobCopy -SrcBlob -SrcContainer -DestContainer -DestBlob -Context -DestContext 值的方式确定复制操作是否完成。 = | Get- (.Status { = | Get--Sleep 10

Remove-AzureStorageBlob -Container -Blob -Context

Set-AzureStorageContainerAcl -Name -Context -Permission Blob

大佬总结

以上是大佬教程为你收集整理的PowerShell 操作 Azure Blob Storage全部内容,希望文章能够帮你解决PowerShell 操作 Azure Blob Storage所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: