Lab 029: Create a Public Blob Container Using Azure CLI
Requirements
As part of the data migration process, the Nautilus DevOps team is actively creating several Azure Blob Storage containers. They plan to utilize both private and public Blob containers to store the relevant data. Given the ongoing migration of other infrastructure to Azure, it is logical to consolidate data storage within the Azure environment as well. Recent security restrictions have revoked Azure portal access. Nevertheless, the team retains CLI access via the azure-client host (the landing host for this lab), allowing them to manage Azure resources effectively.You are tasked with below:
Create a Blob Storage container through Azure CLI with the following details:
-
The name of the container must be xfusion-blob-10978.
-
It must be a public container.
-
Use an existing storage account named xfusionstorage13380.
This page keeps the original requirement text unchanged and documents one direct Azure CLI flow to create and validate a public blob container.
Prerequisites
- Azure CLI is installed and authenticated.
- Storage account
xfusionstorage13380exists and is accessible. - You can retrieve storage account keys in the target resource group.
Steps
For the Azure credentials, enter showcreds command. For further details, check out the Project Nautilus documentation.
# Declare variables
RG=$(az group list --query "[?contains(name, 'kml')].name" --output tsv)
STORAGE_ACCOUNT_NAME=xfusionstorage13380
CONTAINER_NAME=xfusion-blob-10978
# Get the storage account key
STORAGE_ACCOUNT_KEY=$(az storage account keys list --resource-group $RG --account-name $STORAGE_ACCOUNT_NAME --query "[0].value" --output tsv)
# Create the Blob Storage container and set the access level to public
az storage container create \
--name $CONTAINER_NAME \
--account-name $STORAGE_ACCOUNT_NAME \
--account-key $STORAGE_ACCOUNT_KEY \
--public-access container
# Verify the container properties
az storage container show \
--name $CONTAINER_NAME \
--account-name $STORAGE_ACCOUNT_NAME \
--account-key $STORAGE_ACCOUNT_KEY \
--query "{name:name, publicAccess:properties.publicAccess}" \
--output table
Verification
- Confirm container
xfusion-blob-10978exists. - Confirm
publicAccessis set tocontainer.
az storage container show \
--name xfusion-blob-10978 \
--account-name xfusionstorage13380 \
--account-key "$STORAGE_ACCOUNT_KEY" \
--query "{name:name,publicAccess:properties.publicAccess}" \
--output table