This repo contains infrastructure as code for deploying a RAG based implementation to support an AI Model.
To manage your Azure resources, you need to install the Azure CLI. Follow the instructions below to download and install it on your system.
- Download the Azure CLI installer from the following link: Azure CLI Installer.
- Run the installer and follow the on-screen instructions.
- Open your terminal.
- Run the following command to install Azure CLI using Homebrew:
brew update && brew install azure-cli
-
Open your terminal.
-
Run the following commands to install Azure CLI using the package manager for your distribution:
Debian/Ubuntu:
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bashRHEL/CentOS:
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc sudo sh -c 'echo -e "[azure-cli] name=Azure CLI baseurl=https://packages.microsoft.com/yumrepos/azure-cli enabled=1 gpgcheck=1 gpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/azure-cli.repo' sudo yum install azure-cli
Fedora:
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc sudo dnf install -y https://packages.microsoft.com/yumrepos/azure-cli/azure-cli-2.0.81-1.el7.x86_64.rpm
openSUSE:
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc sudo zypper addrepo --name 'Azure CLI' --check https://packages.microsoft.com/yumrepos/azure-cli azure-cli sudo zypper install --from azure-cli -y azure-cli
After installation, you can verify the installation by running:
az --versionThe following steps will make it possible to deploy with a brand new network: For deploying to Azure Government run the following:
az cloud set --name AzureUSGovernmentThe following is the command to login.
az loginFirst this deployment requires a resource group and a virtual network to work with. If those do not exist, run the following to stand them up.
RESOURCE_GROUP_NAME="search-rag-demo-rg"
VNET_NAME="search-rag-vnet"
LOCATION="usgovvirginia"
SUBNET_NAME="default"
# Create the resource group
az group create --name $RESOURCE_GROUP_NAME --location $LOCATION
# Create the virtual network
az network vnet create --name $VNET_NAME --resource-group $RESOURCE_GROUP_NAME --subnet-name $SUBNET_NAMEIf you already have a vnet, then run the following:
RESOURCE_GROUP_NAME="search-rag-demo-rg"
PROJECT_PREFIX="rag"
ENV_PREFIX="dev1"
EXISTING_NETWORK_NAME="search-rag-vnet"
DEFAULT_TAG_NAME="environment"
DEFAULT_TAG_VALUE="search-rag"
az deployment group create --resource-group $RESOURCE_GROUP_NAME --template-file ./main.bicep --parameters project_prefix=$PROJECT_PREFIX env_prefix=$ENV_PREFIX existing_network_name=$EXISTING_NETWORK_NAME default_tag_name=$DEFAULT_TAG_NAME default_tag_value=$DEFAULT_TAG_VALUEIf you want to control and deploy only specific pieces, there are options for controlling which parts are deployed, default is 'true' for these values:
DEPLOY_SEARCH=true
DEPLOY_LOGIC_APP=true
DEPLOY_STORAGE=true
az deployment group create --resource-group $RESOURCE_GROUP_NAME --template-file ./main.bicep --parameters project_prefix=$PROJECT_PREFIX env_prefix=$ENV_PREFIX existing_network_name=$EXISTING_NETWORK_NAME default_tag_name=$DEFAULT_TAG_NAME default_tag_value=$DEFAULT_TAG_VALUE deploy_storage=$DEPLOY_STORAGE deploy_logic_app=$DEPLOY_LOGIC_APP deploy_logic_app=$DEPLOY_LOGIC_APPIf you wish, you can deploy this template with a jumpbox and bastion enabled. This will allow validation of the private deployment.
You can run the following to deploy the environment:
RESOURCE_GROUP_NAME="search-rag-demo-rg"
PROJECT_PREFIX="rag"
ENV_PREFIX="dev1"
EXISTING_NETWORK_NAME="search-rag-vnet"
DEFAULT_TAG_NAME="environment"
DEFAULT_TAG_VALUE="search-rag"
az deployment group create --resource-group $RESOURCE_GROUP_NAME --template-file ./main.bicep --parameters project_prefix=$PROJECT_PREFIX env_prefix=$ENV_PREFIX existing_network_name=$EXISTING_NETWORK_NAME default_tag_name=$DEFAULT_TAG_NAME default_tag_value=$DEFAULT_TAG_VALUE deploy_jumpbox=trueADMIN_USERNAME=""
ADMIN_PASSWORD=""
JUMPBOX_SUBNET_ID=""
az deployment group create --resource-group $RESOURCE_GROUP_NAME --template-file ./main-jumpbox.bicep --parameters project_prefix=$PROJECT_PREFIX env_prefix=$ENV_PREFIX default_tag_name=$DEFAULT_TAG_NAME default_tag_value=$DEFAULT_TAG_VALUE admin_username=$ADMIN_USERNAME admin_password=$ADMIN_PASSWORD jumpbox_subnet_id=$JUMPBOX_SUBNET_IDFor this template, you can create a subnet by enabling the "deploy_aoai" set to true, and then run the following:
First run this to deploy the environment:
RESOURCE_GROUP_NAME="search-rag-demo-rg"
PROJECT_PREFIX="rag"
ENV_PREFIX="dev1"
EXISTING_NETWORK_NAME="search-rag-vnet"
DEFAULT_TAG_NAME="environment"
DEFAULT_TAG_VALUE="search-rag"
az deployment group create --resource-group $RESOURCE_GROUP_NAME --template-file ./main.bicep --parameters project_prefix=$PROJECT_PREFIX env_prefix=$ENV_PREFIX existing_network_name=$EXISTING_NETWORK_NAME default_tag_name=$DEFAULT_TAG_NAME default_tag_value=$DEFAULT_TAG_VALUE deploy_openai=true deploy_jumpbox=trueADMIN_EMAIL=""
AOAI_SUBNET_ID=""
az deployment group create --resource-group $RESOURCE_GROUP_NAME --template-file ./main-aoai.bicep --parameters project_prefix=$PROJECT_PREFIX env_prefix=$ENV_PREFIX default_tag_name=$DEFAULT_TAG_NAME default_tag_value=$DEFAULT_TAG_VALUE admin_email=$ADMIN_EMAIL subnet_id=$AOAI_SUBNET_IDTo clean up the resources, you can run the following command:
az group delete -n $RESOURCE_GROUP_NAME -y