Reputation: 7959
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://learn.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?
Upvotes: 4
Views: 2364
Reputation: 608
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>
Upvotes: 2
Reputation: 42043
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>
Upvotes: 9