Search code examples
azureazure-bicepazure-openai

OpenIA deployment with bicep


Im trying to deploy the OpenAI resurce in North Europe but I get below error

Exception Details: (InvalidApiSetId) The account type 'OpenAI' is either invalid or unavailable in given region. Code: InvalidApiSetId Message: The account type 'OpenAI' is either invalid or unavailable in given region.

Is it not available in northeurope or my api is not working? Belo is my code which worked 2 weeks ago for Westeurope region

param openAIAccountName string
param location string = resourceGroup().location

param privatesubnetId string
param publicsubnetId string
param IPRules array

resource openAIAccount 'Microsoft.CognitiveServices/accounts@2024-04-01-preview' = {
  name: openAIAccountName
  location: location
  sku: {
    name: 'S0'
  }
  kind: 'OpenAI'
  properties: {
    publicNetworkAccess: 'Enabled'
    customSubDomainName: openAIAccountName
    networkAcls: {
      defaultAction: 'Deny'
      virtualNetworkRules: [
        {
          id: privatesubnetId
        }
        {
          id:publicsubnetId
        }
      ]
      ipRules: [
        for ip in IPRules: {
          value: ip
        }
      ]
    }
  }
}

resource gpt3_5 'Microsoft.CognitiveServices/accounts/deployments@2024-04-01-preview' = {
  parent: openAIAccount
  name: 'gpt35Endpoint'
  sku: {
    name: 'Standard'
    capacity: 120
  }
  properties: {
    model: {
      format: 'OpenAI'
      name: 'gpt-35-turbo'
      version: '0301'
    }
    versionUpgradeOption: 'OnceNewDefaultVersionAvailable'
    currentCapacity: 120
    raiPolicyName: 'Microsoft.Default'
  }
}

Solution

  • OpenAI deployment with bicep

    After running through multiple case I was able to figure out the issue. It seems to be the use of region name northeurope

    While achieving the same in the portal I came to know that there is only one key word which matches europe is while using west Europe

    Go to the portal and see the list of regions available to deploy the model that is avaialble nearby north europe

    i.e., France Central,Germany West Central,Norwayeast,Poland Central,Spain Central,Sweden Central,Switzerland North,Switzerland West,UK South,west europe

    these regions are specifically for the europe based on the availablity and quota

    image

    Demo configruation:

    resource openAIAccount 'Microsoft.CognitiveServices/accounts@2024-04-01-preview' = {
      name: openAIAccountName
      location: location
      sku: {
        name: 'S0'
      }
      kind: 'OpenAI'
      properties: {
        publicNetworkAccess: 'Enabled'
        customSubDomainName: openAIAccountName
        networkAcls: {
          defaultAction: 'Deny'
          virtualNetworkRules: [
            {
              id: virtualNetwork.properties.subnets[0].id
            }
          ]
          ipRules: [
            for ip in ipRules: {
              value: ip
            }
          ]
        }
      }
    }
    
    resource openAIDeployment 'Microsoft.CognitiveServices/accounts/deployments@2024-04-01-preview' = {
      parent: openAIAccount
      name: deploymentName
      sku: {
        name: 'Standard'
        capacity: modelCapacity
      }
      properties: {
        model: {
          format: 'OpenAI'
          name: modelName
          version: modelVersion
        }
        versionUpgradeOption: 'OnceNewDefaultVersionAvailable'
        currentCapacity: modelCapacity
        raiPolicyName: 'Microsoft.Default'
      }
    }
    

    Here i tried deployement using France Central region situated in northen part of europe or nearer to it and my RG was north europe

    deployment:

    enter image description here

    enter image description here

    refer:

    Create an Azure AI services resource using Bicep - Azure AI services | Microsoft Learn

    Info related to quota can be refered here

    https://learn.microsoft.com/en-us/azure/cognitive-services/openai/quotas-limits