openai-landing-zone-hack

Deploy Azure OpenAI

Learning Objective

  1. Understand the components of the Azure OpenAI Landing Zone reference architecture.
  2. Deploy Azure OpenAI Service with API Management.

Prerequisites

Create a GitHub repository from a template

  1. Navigate to pascalvanderheiden/ais-apim-openai and login with your GitHub account.

  2. Click the “Use this template” button, or click here.

    Use this template

  3. Select a repository name and click “Create repository”.

    Create repository

  4. You can choose to clone the repository locally, or create a codespace.

    Note: If you opt to clone the repository locally, you will need to install the Azure Developer CLI.

Deploy Azure OpenAI with API Management

Note: It can take up to 45 minutes to deploy Azure API Management. We recommend you start the deployment first and then spend some time familiarise yourself with the repository (see next section).

  1. Initialize a new azd environment. azd will prompt you to provide a name that will later be used in the name of the deployed resources.

     azd init
    

    azd init

  2. Authenticate to Azure

     azd auth login
    
  3. Provision and deploy all the resources

     azd up
    

    azd up

    Note: azd will prompt you to login, pick a subscription, and provide a location (like “eastus”). You can find more information about the availability of Azure OpenAI here.

    Note: Sometimes the DNS Zones for the Private Endpoints aren’t created correctly / in time. If you get an error when you deploy the resources, it may be required to redeploy.

    azd up
    

Familiarise yourself with the repository

The repository you have created is based on the Azure OpenAI Landing Zone reference architecture. We will leverage the Infrastructure-as-code (IaC) under the infra folder to provision Azure OpenAI, Azure API Management, along with best practices for security, network isolation, monitoring, etc.

  1. Review the solution architecture. Each component’s purpose is described here.

    Solution Architecture

  2. Review the Infrastructure-as-code (IaC).

Test the API endpoint

  1. Once the deployment has completed, navigate to the Azure Portal and open the resource group that was created by azd. Spend some time familiarising yourself with the resources that were deployed.

  2. Open the API Management instance and click on “APIs”.

  3. Select the “Azure OpenAI Service API” API and open the “Creates a completion for the chat message” operation.

  4. Navigate to the “Test” tab.

    Test API

  5. Enter the following values under “Template parameters”:

    • deployment-id: chat
    • api-version: 2023-03-15-preview
  6. (optional) Under “Request body” update the prompt content to something like “Hello, my name is John. What is the capital of France?”

     {"model":"gpt-35-turbo","messages":[{"role":"user","content":"Hello, my name is John. What is the capital of France?"}]}
    
  7. Click “Send”.

    Test API

  8. Scroll down, you will find the “HTTP response” with the response from the Azure OpenAI Service.

    Test API


Next Lab