简体   繁体   English

如何使用 Powershell 连接到本地 Azure 存储模拟器?

[英]How to use Powershell to connect to local Azure Storage emulator?

I'm trying to write a powershell script that creates all of my azure storage containers and stuff, as opposed to manually creating them through some GUI.我正在尝试编写一个 powershell 脚本来创建我所有的 azure 存储容器和东西,而不是通过一些 GUI 手动创建它们。

I'm looking at the following documentation website, but see no way to connect to my local azure storage service - only the actual azure services.我正在查看以下文档网站,但看不到连接到我本地 azure 存储服务的方法 - 只有实际的 azure 服务。

https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-powershell https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-powershell

Does anybody know how to, or if it's possible to, connect to the local storage emulator?有人知道如何连接到本地存储模拟器吗?

Does anybody know how to, or if it's possible to, connect to the local storage emulator?有人知道如何连接到本地存储模拟器吗?

Yes, you can.是的你可以。 For more details, refer to this link .有关更多详细信息,请参阅此链接

Note : You need to run your Storage Emulator first before excute the command.注意:在执行命令之前,您需要先运行存储模拟器。

Samples :样品

1.Create a context by using the local development storage account 1.使用本地开发存储账号创建上下文

New-AzureStorageContext -Local

2.Get the container for the local developer storage account 2.获取本地开发者存储账号的容器

New-AzureStorageContext -Local | Get-AzureStorageContainer

3.Create a new container 3.新建一个容器

New-AzureStorageContext -Local | New-AzureStorageContainer -Name <containername>

Powershell syntax has been updated since 2018. Powershell 语法自 2018 年以来已更新。

The new cmdlets use the prefix Az instead of Azure so:新的 cmdlet 使用前缀 Az 而不是 Azure,因此:

New-AzStorageContext -Local | Get-AzStorageContainer

New-AzStorageContext -Local | New-AzStorageContainer -Name <containername>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM