Skip to main content
Pure Technical Services

Deploy using Azure Bicep | Pure CBS on Azure

Currently viewing public documentation. Please login to access the full scope of documentation.

KP_Ext_Announcement.png

 

 

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.

  1. Clone the git repository from GitHub and change working directory to the cloned repository.
  2. To install required tools execute a setup script:
    $ ./00-setup-machine.sh
  3.  This script is designed to install all required tools on your computer. When you clone the repository, execute the script.
  4. 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).

  1. Clone the git repository from GitHub and change working directory to the cloned repository.
  2. To build a container image, execute following command: 
    $ docker build . -t cbs-bicep
  3. When the container image is ready, run with following:
    $ docker run -v .:/data -it cbs-bicep
  4. And follow instructions on the screen to authenticate into Azure CLI via device code login method.
  5. In the container image you don't need to run 00-setup-machine.shscript.

 

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:

  1. Check if selected region is supported by CBS (supported regions list)
  2. Have an Azure Active Directory Premium 2 license (more details)
  3. Rename the parameter file 01-prereq.bicepparam.example to 01-prereq.bicepparam
    $ mv 01-prereq.bicepparam.example 01-prereq.bicepparam
    
  4. 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 the templates/prerequisites.bicep file or use Visual Studio Code with a Bicep extension, which provides IntelliSense code hinting.
     
  5. Execute the deployment script with:
    $ ./01-deploy-prerequisities.sh
  6. 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.
    clipboard_eae045f7ec4877245ca419bc299024183.png

 

Module #02 - CBS Managed App Deployment

After deploying all prerequisites, you can proceed with deployment of CBS Managed App.

  1. Rename the parameter file 02-cbs.bicepparam.example to 02-cbs.bicepparam
    $ mv 02-cbs.bicepparam.example 02-cbs.bicepparam
  2. 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.
  3. 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.
  4. Execute the deployment script with (takes up to ~25mins):
    $ ./02-deploy-cbs.sh
    
    clipboard_e90a45c06470577db03194fa03e136db9.png
  5. 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:

  1. Rename the parameter file 03-test-vm.bicepparam.example to 03-test-vm.bicepparam
    $ mv 03-test-vm.bicepparam.example 03-test-vm.bicepparam
  2. 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 in extensionFileUrl and extensionCustomizeUXFileUrl. 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.
     
  3. 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.
  4. Execute the deployment script with (takes up to ~30mins, depends on Azure's current load):
    $ ./03-deploy-test-vm.sh
    
    clipboard_e76e917f42e628d1d8140342bcbaedc41.png
  5. 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 parameter whitelistedSourceAddress 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.

    clipboard_ebbd6db673f98635ac5f174c178d6064c.png

     
  6. 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:

    clipboard_ebc0778b647d087d0f809819deb8a6ae5.png

    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.

    clipboard_e7f5a76f159da81341aa251d63e4efe76.png

    clipboard_e661141e996660e6b771449459850c70d.png

    clipboard_e70b484db9c084fc8d1bb30b9e9d568d0.png

    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.

bicep-e2e-demo.gif

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:

  1. Rename the parameter file e2e-demo-params.sh.example to e2e-demo-params.sh
    $ mv e2e-demo-params.sh.example e2e-demo-params.sh
  2. 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 in extensionFileUrl and extensionCustomizeUXFileUrl. 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.
  3. Execute the deployment script with (takes up to ~60mins, depends on Azure's current load):
    $ ./deploy-e2e-demo.sh
  4. 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.

    clipboard_ebbd6db673f98635ac5f174c178d6064c.png

     
  5. 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.