Deploy an Azure Storage Account
In this article I show you how to deploy a storage account with basic parameters to your subscription. During the course of learning and testing you will find that you need to create and delete storage accounts in your Testing Subscription fairly often. Let’s take a look at how we can create storage with some different options quickly and then clean it up when we’re done testing.
Let’s turn to our good friend Cloud Shell.
First, let’s get logged into https://portal.azure.com and head right into Cloud Shell.
Now, let’s use a resource group to keep this all nice & neat today. Let’s create one together:
az group create --name rgDemoControl1 --location canadacentral
Great! Now we have a resource group called “rgDemoControl1” that we can use for some demo testing! Super easy and fast.
Next, let’s create that storage account and call it “stortest28”, we’ll make it a v2 storage account also living in Canada Central:
az storage account create --name stortest28 --resource-group rgDemoControl1 --location canadacentral --kind StorageV2 --sku Standard_LRS
Next let’s apply the encryption scope onto the storage account using Microsoft managed keys:
az storage account encryption-scope create --resource-group rgDemoControl1 --account-name stortest28 --name scope1 --key-source Microsoft.Storage
Ok, great so far! Now we have a storage account and an encryption scope.
If you check your storage account under Encryption and Encryption Scopes you’ll see that our ‘scope1’ is showing as enabled. Now we just need to apply it to something in the storage account.
Next let’s run the container statement below in CLI again and bring it all together:
az storage container create --account-name stortest28 --resource-group rgDemoControl1 --name testcontainer --default-encryption-scope scope1 --prevent-encryption-scope-override true --
Cool. Now you have an encrypted container to use for your testing data along with other resources in your resource group. Go ahead and test it out!
Awesome, so once you’re done testing let’s clean it up:
az group delete --name rgDemoControl1
This will delete your resource group and ALL the resources living inside it. Be careful & always clean up after you’re done testing or exploring!
Read more: https://docs.microsoft.com/en-us/cli/azure/storage/account?view=azure-cli-latest