🗄️ Step 1: Create Azure SQL Database
Create a SQL Server database in the same resource group as your AKS cluster:
# Set variables - REPLACE WITH YOUR VALUES
RESOURCE_GROUP="rg-regscale-prod"
LOCATION="eastus"
SQL_SERVER_NAME="regscale-sql-server"
DATABASE_NAME="regscale"
ADMIN_USERNAME="regscale_admin"
ADMIN_PASSWORD="YourSecurePassword123!"
# Create resource group
az group create --name $RESOURCE_GROUP --location $LOCATION
# Create SQL Server
az sql server create \
--name $SQL_SERVER_NAME \
--resource-group $RESOURCE_GROUP \
--location $LOCATION \
--admin-user $ADMIN_USERNAME \
--admin-password $ADMIN_PASSWORD
# Create SQL Database
az sql db create \
--resource-group $RESOURCE_GROUP \
--server $SQL_SERVER_NAME \
--name $DATABASE_NAME \
--service-objective S2
# Configure firewall to allow Azure services
az sql server firewall-rule create \
--resource-group $RESOURCE_GROUP \
--server $SQL_SERVER_NAME \
--name "AllowAzureServices" \
--start-ip-address 0.0.0.0 \
--end-ip-address 0.0.0.0
# Get SQL Server FQDN
SQL_FQDN=$(az sql server show \
--name $SQL_SERVER_NAME \
--resource-group $RESOURCE_GROUP \
--query "fullyQualifiedDomainName" --output tsv)
echo ""
echo "=== Azure SQL Database Setup Complete ==="
echo "Resource Group: $RESOURCE_GROUP"
echo "SQL Server: $SQL_SERVER_NAME"
echo "SQL FQDN: $SQL_FQDN"
echo "Database: $DATABASE_NAME"
echo "Location: $LOCATION"
💾 Step 2: Create Blob Storage
Create an Azure Blob Storage account and container for RegScale data storage:
# Set variables for Blob Storage (reuse resource group from Step 1)
STORAGE_ACCOUNT="regscalestorageprod"
CONTAINER_NAME="regscale-data"
# Create storage account
az storage account create \
--name $STORAGE_ACCOUNT \
--resource-group $RESOURCE_GROUP \
--location $LOCATION \
--sku Standard_LRS \
--kind StorageV2
# Get storage account key
STORAGE_KEY=$(az storage account keys list \
--resource-group $RESOURCE_GROUP \
--account-name $STORAGE_ACCOUNT \
--query '[0].value' --output tsv)
# Create blob container
az storage container create \
--name $CONTAINER_NAME \
--account-name $STORAGE_ACCOUNT \
--account-key $STORAGE_KEY
echo ""
echo "=== Azure Blob Storage Setup Complete ==="
echo "Storage Account: $STORAGE_ACCOUNT"
echo "Container Name: $CONTAINER_NAME"
echo "Resource Group: $RESOURCE_GROUP"
⚙️ Step 3: Install Blob CSI Driver
Install the Azure Blob CSI driver on your AKS cluster:
# Install Blob CSI driver as an AKS add-on
az aks addon install \
--resource-group $RESOURCE_GROUP \
--name \
--addon blob-csi-driver
# Verify the installation
kubectl get pods -n kube-system -l app=csi-blob-controller
kubectl get pods -n kube-system -l app=csi-blob-node
🔐 Step 4: Create Kubernetes Secret
Create a Kubernetes secret containing the Azure storage credentials:
# Create the storage secret in your AKS cluster
kubectl create secret generic azure-storage-secret \
--from-literal=azurestorageaccountname=$STORAGE_ACCOUNT \
--from-literal=azurestorageaccountkey=$STORAGE_KEY \
--namespace regscale