简体   繁体   中英

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.

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.

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

New-AzureStorageContext -Local

2.Get the container for the local developer storage account

New-AzureStorageContext -Local | Get-AzureStorageContainer

3.Create a new container

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

Powershell syntax has been updated since 2018.

The new cmdlets use the prefix Az instead of Azure so:

New-AzStorageContext -Local | Get-AzStorageContainer

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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