Deploy using Azure Bicep | Pure CBS on Azure
This framework for Azure Bicep language is a community open-source project and is provided as-is. You bear all risk relating to the use or performance of the sample script and documentation.
Introduction
This document demonstrates the steps required to deploy Pure Cloud Block Store (CBS) in Azure with an infrastructure-as-code approach using Azure Bicep language.
The Bicep framework for CBS deployment comes with Bicep templates and bash scripts, combined from following modules:
- Module #01 (Prerequisites) - this module deploys all the resources required for CBS deployment, including Virtual Network, User-Managed Identity, Custom Role, and others.
- Module #02 (CBS Managed App) - this module deploys the CBS Managed App itself into the environment with all prerequisites met.
- Module #03 (Test VM) - This module provisions a test Virtual Machine (VM) of Windows Server 2019 with pre-installed MS SQL server and configures test volumes in CBS instance to mount them via iSCSI protocol.
- Module #04 (E2E Demo) 🧪 - For hands-on/testing purposes, this module combines all Modules #01-#03 (described above) and deploys all required resources, CBS Managed App itself and a test Virtual Machine from the single deployment script.
All these deployed resources are modular and can be customized for your environment as needed.
Repository Information
The whole codebase of Bicep framework for CBS deployment is an open-source project available on GitHub.
We appreciate your help - if you want to contribute, please read the Contributing section in the README
file in the repository.
Usage
Prior to using the Bicep framework for CBS deployment, you must choose between running the scripts on your machine with all the necessary tools installed or running the scripts within the pre-prepared container image.
Configure machine or use container image
The framework requires az-cli, bicep-cli and jq tools.
Local installation
On Windows is recommended to use Windows Subsystem for Linux (WSL) to run all scripts in this repository.
- Clone the git repository from GitHub and change working directory to the cloned repository.
- To install required tools execute a setup script:
$ ./00-setup-machine.sh
- This script is designed to install all required tools on your computer. When you clone the repository, execute the script.
- The script will ask you to authenticate into Azure CLI via device code login method.
Container Image
Alternatively, in the repository is a container image, that has all the tools you need. Just build the image and run the commands inside the container (for example, with Docker).
- Clone the git repository from GitHub and change working directory to the cloned repository.
- To build a container image, execute following command:
$ docker build . -t cbs-bicep
- When the container image is ready, run with following:
$ docker run -v .:/data -it cbs-bicep
- And follow instructions on the screen to authenticate into Azure CLI via device code login method.
- In the container image you don't need to run a
00-setup-machine.sh
script.
Module #01 - Prerequisites for CBS Deployment
A number of mandatory resources have to be checked and configured prior to CBS deployment (for more details see Cloud Block Store Deployment and Configuration Guide for Azure).
The repository contains templates for all these mandatory resources (prerequisites).
To deploy all prerequisites:
- Check if selected region is supported by CBS (supported regions list)
- Have an Azure Active Directory Premium 2 license (more details)
- Rename the parameter file
01-prereq.bicepparam.example
to01-prereq.bicepparam
$ mv 01-prereq.bicepparam.example 01-prereq.bicepparam
- Replace the placeholders in the parameter file with actual values for the required minimum parameters, which include location, subscription ID, and resource group name.
The parameter file supports other optional parameters to customize deployment. For more information, you can refer to thetemplates/prerequisites.bicep
file or use Visual Studio Code with a Bicep extension, which provides IntelliSense code hinting.
- Execute the deployment script with:
$ ./01-deploy-prerequisities.sh
- As output of the script you can find parameters for deployed resources, including vNET name, User Managed Identity resource ID and other needed parameters for CBS on Azure deployment.
Module #02 - CBS Managed App Deployment
After deploying all prerequisites, you can proceed with deployment of CBS Managed App.
- Rename the parameter file
02-cbs.bicepparam.example
to02-cbs.bicepparam
$ mv 02-cbs.bicepparam.example 02-cbs.bicepparam
- Replace the placeholders in the parameter file with actual values for the required minimum parameters, which include location, subscription ID, resource group name, resource name, virtual network name, resource ID of the User Managed Identity and others.
- The parameter file supports other optional parameters to customize deployment. For more information, you can refer to the
templates/cbs-managed-app.bicep
file or use Visual Studio Code with a Bicep extension, which provides IntelliSense code hinting. - Execute the deployment script with (takes up to ~25mins):
$ ./02-deploy-cbs.sh
- As output of the script you can find parameters for deployed CBS instance, including IP address of load balancer for management interface or IP addresses for iSCSI mount.
Module #03 - Test VM Deployment
This module is an example of deploying a Windows Server test virtual machine with pre-installed MS SQL server and with automatic configuration of CBS (creating volumes for the test VM) and auto-mount of these volumes on the machine via iSCSI.
After deploying CBS Managed App, you can proceed with deployment of test VM:
- Rename the parameter file
03-test-vm.bicepparam.example
to03-test-vm.bicepparam
$ mv 03-test-vm.bicepparam.example 03-test-vm.bicepparam
- Replace the placeholders in the parameter file with actual values for the required minimum parameters, which include location, subscription ID, resource group name, IP address of CBS management load balancer (can be found as output of CBS Managed App deployment), VM size and others.
For automatic configuration is essential link to custom extension script file present inextensionFileUrl
andextensionCustomizeUXFileUrl
. By default, these variables refer to files stored in GitHub repository.
In case you want to change these extension files, please keep in mind these files needs to be accessible from the internet (e.g. hosted from GitHub or an Azure Blob Storage). For more details about custom extension files, see Microsoft Docs.
- The parameter file supports other optional parameters to customize deployment. For more information, you can refer to the
templates/cbs-managed-app.bicep
file or use Visual Studio Code with a Bicep extension, which provides IntelliSense code hinting. - Execute the deployment script with (takes up to ~30mins, depends on Azure's current load):
$ ./03-deploy-test-vm.sh
- When the deployment finishes, as output of the script you can find parameters for deployed VM instance, including VM public IP address.
By default, there is a Network Security Group for this VM in place restricting access to RDP just for your current public IP address. This can be changed with parameterwhitelistedSourceAddress
in the parameter file.
When the script runs in the Windows Subsystem for Linux or in MacOS, it will try to open an RDP connection automatically as the last step of the deployment script.
- At this moment, the test VM should be online and listen for RDP connections. When you log in into the VM via RDP, you will see two extra shortcuts on desktop:
Disk Management - opens a standard Windows Disk Management Tool, where you can check the mounted CBS volumes
Open CBS Console - this shortcut opens a CBS GUI Management Console in Microsoft Edge browser.
To access the CBS instance via CLI, refer to Logging onto CBS via CLI section in the Deployment and Configuration Guide.
Module #04 - Deploy a E2E DEMO of CBS on Azure
For hands-on/testing purposes, the Bicep framework repository enables option for deploying all required resources, CBS Managed App and a test Virtual Machine (VM) of Windows Server 2019 with pre-installed SQL server (combines all Modules #1-#3 described above) in the single deployment script deploy-e2e-demo.sh.
This deployment script deploys the latest version of CBS automatically with a test license for 45 days (more details about Test license).
To start with E2E Demo deployment:
- Rename the parameter file
e2e-demo-params.sh.example
toe2e-demo-params.sh
$ mv e2e-demo-params.sh.example e2e-demo-params.sh
- Replace the placeholders in the parameter file with actual values for the required minimum parameters, which include location, subscription ID, resource group name, availability zone for CBS, test VM size (SKU), test VM credentials and others.
For automatic configuration is essential link to custom extension script file present inextensionFileUrl
andextensionCustomizeUXFileUrl
. By default, these variables refer to files stored in GitHub repository.
In case you want to change these extension files, please keep in mind these files needs to be accessible from the internet (e.g. hosted from GitHub or an Azure Blob Storage). For more details about custom extension files, see Microsoft Docs. - Execute the deployment script with (takes up to ~60mins, depends on Azure's current load):
$ ./deploy-e2e-demo.sh
- When the deployment finishes, as output of the script you can find parameters for deployed VM instance, including VM public IP address.
By default, there is a Network Security Group for this VM in place restricting access to RDP just for your current public IP address.
When the script runs in the Windows Subsystem for Linux or in MacOS, it will try to open an RDP connection automatically as the last step of the deployment script.
- At this moment, the deployment is completed and you can proceed to test VM (more info about test VM above).
Troubleshooting
Test VM (SQL virtual machine) deployment takes too long
Based on current Azure load in selected region, you may experience slower deployment (>= 20 minutes) of Azure resource SQL virtual machine.
When this occurs, please try to change VM size (SKU) to different one.
Removing deployed resources
To remove a deployed CBS instance please follow the instructions on Removing Cloud Block Store page.