In this blog post, it is shown how to deploy an Azure Storage account using Bicep, a declarative language for describing and deploying Azure resources, and GitHub Actions, a CI/CD solution that’s directly integrated into GitHub.
The Bicep File
Our Bicep file, main.bicep
, starts by defining a few parameters:
storagePrefix
: A string parameter that will be used as a prefix for the storage account name. It must be between 3 and 11 characters long.storageSKU
: The SKU of the storage account. It defaults to ‘Standard_LRS’, but other options like ‘Standard_GRS’, ‘Standard_RAGRS’, ‘Standard_ZRS’, ‘Premium_LRS’, ‘Premium_ZRS’, ‘Standard_GZRS’, and ‘Standard_RAGZRS’ are also allowed.location
: The location where the storage account will be deployed. It defaults to the location of the resource group.
The Bicep file then defines a unique name for the storage account by concatenating the storagePrefix
and a unique string derived from the resource group’s ID.
Next, it defines a resource of type ‘Microsoft.Storage/storageAccounts@2021-04-01’ with the unique name, the specified location, and the specified SKU. The kind of the storage account is set to ‘StorageV2’, and it’s configured to support HTTPS traffic only.
Finally, the Bicep file defines an output named storageEndpoint
that contains the primary endpoints of the storage account.
See the main.bicep file here
Deploying with GitHub Actions
With the Bicep file defined, we can now use GitHub Actions to automate its deployment. In a future blog post, we’ll explore how to set up a GitHub Actions workflow that deploys this Bicep file whenever changes are pushed to the bicep_1
branch of our repository.
Link: https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/deploy-github-actions