
Explanation:
Step 1:
Create a resource group
A resource group is a logical container in which Azure resources are deployed and managed. If you don't already have an Azure resource group, you can use the az group create command to create one.
The following example creates a resource group named myResourceGroup in the East US location:
az group create --name myResourceGroup --location eastus
Step 2:
Create a storage account
The following example creates a storage account named mystorageaccount<random number> by using the az storage account create command, and then puts the name of that storage account in the $STORAGEACCT variable.
STORAGEACCT=$(az storage account create \
--resource-group "myResourceGroup" \
--name "mystorageacct$RANDOM" \
--location eastus \
--sku Standard_LRS \
--query "name" | tr -d '"')
Step 3:
Get the storage account key
Storage account keys control access to resources in a storage account. The keys are automatically created when you create a storage account. You can get the storage account keys for your storage account by using the az storage account keys list command:
STORAGEKEY=$(az storage account keys list \
--resource-group "myResourceGroup" \
--account-name $STORAGEACCT \
--query "[0].value" | tr -d '"')
Step 4:
Now, you can create your Azure file share. Create file shares by using the az storage share create command. This example creates an Azure file share named myshare:
az storage share create \
--account-name $STORAGEACCT \
--account-key $STORAGEKEY \
--name "myshare"
References:
https://docs.microsoft.com/en-us/azure/storage/files/storage-how-to-use-files-cli