Azure AI Services
Connecting to an Azure AI service from a DevZero workspace.
This guide explains connecting to an Azure AI service running on Azure infrastructure from your DevBox.
Architecture Diagram
Azure AI Services is a suite of cloud-based artificial intelligence (AI) services that help developers and organizations create intelligent, cutting-edge, market-ready, and responsible applications with out-of-the-box and pre-built tools, APIs, and models.
This connection between the Azure AI Service Playground and your DevBox would occur by setting up a bastion host that advertises the private routes to your DevZero network so you can access the private service through network tunneling. You must also set up a DNS Private Resolver to access the AI Services's Private Endpoint from your DevBox.
Prerequisites
- Before you begin, follow the Connecting to Azure guide to set up the Bastion Host to access your private Azure services.
- Following the above criteria, follow the Setting up DNS Private Resolver guide to access the DNS Private Zones.
Existing Azure AI Services
To connect to an Azure AI Playground, ensure it is within the same Resource Group containing the Bastion Host.
Step 1: Creating a Recipe
First, we need to create a recipe for the workspace:
- Go to the DevZero Dashboard > Recipes and click on New recipe.
- Enter the recipe name and click on Create a recipe.
- Now use the below-provided snippet to create a recipe for your workspace:
- Click on Save and Build and when the build is successful, move on to the next step.
Step 2: Creating a Workspace
- Go to the Devzero Dashboard > Workspaces and click on New workspace.
- Enter the workspace name and click on Select from recipe library.
- Select the recipe you just created and click on Select.
- Click on Launch, and your workspace will be ready shortly.
Step 3: Creating a Private Endpoint
To access the service privately, we need to restrict public access and assign it a private endpoint:
- Go to Azure Portal and open your AI Service.
- Go to the Networking section and click on
Disabled
under the Allow access from section. - Go to the Private endpoint connections tab and click on Private Endpoint.
- After that, go to Networking > Private endpoint connections and click on Private endpoint.
- Choose your Resource group and enter the instance name.
- Click Resource and select your desired
Target sub-resource
for your private endpoint. Remember that if you have more than one sub-resource type, you need to create a separate endpoint for each one. - Click on Virtual Network and select your Virtual Network (VNET), which houses the bastion host and DNS Private Resolver.
- Select a compatible subnet, then click on Next, and leave the rest of the settings as default.
- Click on Create, and your Private Endpoint will be created.
Step 4: Accessing the AI Services
Now follow the below steps to access the AI Services on your DevBox:
- Open Azure AI Studio and click on Create New Deployment.
- Choose a base or fine-tuned model and modify the configurations according to your needs.
- Click on Deploy to create and deploy the model to your playground.
- Select the Deployment you just created and click on View Code.
- Copy the API Key and export it to your environmental variables using the following command:
- Below that, you will find code snippets for several languages and frameworks. For this guide, we will demonstrate the secure connection with
curl
. - Copy the code snippet and place it in your TOKEN environmental variable.
- A successful connection will show the same output as below.
New AI Services
If you need to make a new AI Services and access it through DevBox, then follow the below steps:
Step 1: Creating an AI Services
Firstly, you must set up the DNS Private Resolver by following the Setting up DNS Private Resolver guide.
After the steps mentioned earlier are completed, you may go ahead and create a file share for AI Services by following these steps:
- Go to Home > AI Services and click on Create.
- In the Basics section, select the Resource group you previously selected for your VNET.
- Then enter your Region, Name, and Pricing tier.
- In the Networking section click on
Disabled
and then click on Add Private Endpoint. - Choose your Resource group and enter the instance name.
- Click Resource and select your desired
Target sub-resource
for your private endpoint. Remember that if you have more than one sub-resource type, you need to create a separate endpoint for each one. - Click on Virtual Network and select your Virtual Network (VNET), which houses the bastion host and DNS Private Resolver.
- Select a compatible subnet, then click on Next, and leave the rest of the settings as default.
- Click on Create, and your Private Endpoint will be created.
- After setting up the private endpoint, click on Review + Create and click on Create.
Step 2: Creating a Recipe
First, we need to create a recipe for the workspace:
- Go to the DevZero Dashboard > Recipes and click on New recipe.
- Enter the recipe name and click on Create a recipe.
- Now use the below-provided snippet to create a recipe for your workspace:
- Click on Save and Build and when the build is successful, move on to the next step.
Step 3: Creating a Workspace
- Go to the Devzero Dashboard > Workspaces and click on New workspace.
- Enter the workspace name and click on Select from recipe library.
- Select the recipe you just created and click on Select.
- Click on Launch, and your workspace will be ready shortly.
Step 4: Accessing the AI Services
Now follow the below steps to access the AI Services on your DevBox:
- Open Azure AI Studio and click on Create New Deployment.
- Choose a base or fine-tuned model and modify the configurations according to your needs.
- Click on Deploy to create and deploy the model to your playground.
- Select the Deployment you just created and click on View Code.
- Copy the API Key and export it to your environmental variables using the following command:
- Below, you will find code snippets for several languages and frameworks. This guide will demonstrate the secure connection with
curl
. - Copy the code snippet and place it in your TOKEN environmental variable.
- A successful connection will show the same output as below.