How to correctly load openpolicyagent/opa image from public docker hub in azure app service using bicep

mamoorkhan 1 Reputation point
2024-05-14T12:46:19.1733333+00:00

When I deploy Azure App Service and try to load openpolicyagent/opa version 0.64.1 using a bicep template that is attached below, and then I go to deployment center, it does not show the correct settings. What could be the reason?


param serviceEnvironment string
param serviceLocation string
param storageAccountName string
param appInsightsName string
param appServicePlanName string
param appServiceName string

param opaVersion string

param tags object

resource storageAccount 'Microsoft.Storage/storageAccounts@2023-01-01' existing = {
  name: storageAccountName
}

resource appInsights 'Microsoft.Insights/components@2020-02-02' existing = {
  name: appInsightsName
}

resource appService 'Microsoft.Web/sites@2023-01-01' = {
  name: appServiceName
  location: serviceLocation
  tags: tags
  kind: 'linux'
  identity: {
    type: 'SystemAssigned'
  }
  properties: {
    enabled: true
    serverFarmId: appServicePlanName
    siteConfig: {
      linuxFxVersion: 'DOCKER|openpolicyagent/opa:${opaVersion}'
      netFrameworkVersion: 'v8.0'
      azureStorageAccounts: {
        opaconfig: {
          type: 'AzureBlob'
          accountName: storageAccountName
          shareName: 'opa'
          mountPath: '/config'
          accessKey: storageAccount.listKeys().keys[0].value
        }
      }
      alwaysOn: true
      appCommandLine: 'run -s --addr :8181'
    }
  }
}

module appSettingsDeploy './app.service.settings.bicep' = {
  name: 'opaAppServiceSettingsDeploy'
  params: {
    name: '${appServiceName}/appsettings'
    currentAppSettings: list('${appService.id}/config/appsettings', '2021-02-01').properties
    updatedAppSettings: {
      APPINSIGHTS_INSTRUMENTATIONKEY: appInsights.properties.InstrumentationKey
      APPLICATIONINSIGHTS_CONNECTION_STRING: appInsights.properties.ConnectionString
      ApplicationInsightsAgent_EXTENSION_VERSION: '~3'
      ASPNETCORE_ENVIRONMENT: serviceEnvironment
      linuxFxVersion: 'DOCKER|openpolicyagent/opa:${opaVersion}'
      WEBSITES_PORT: 8181
    }
  }
}


Actual screen

User's image

Expected screen
User's image

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,038 questions
{count} votes