|
| 1 | +param siteName string |
| 2 | + |
| 3 | +@secure() |
| 4 | +param jwtSecret string |
| 5 | + |
| 6 | +@secure() |
| 7 | +param sessionSecret string |
| 8 | + |
| 9 | +resource appServicePlan 'Microsoft.Web/serverfarms@2024-04-01' = { |
| 10 | + name: 'web-apps-sweden-central' |
| 11 | + location: 'swedencentral' |
| 12 | +} |
| 13 | + |
| 14 | +resource storageAccount 'Microsoft.Storage/storageAccounts@2024-01-01' existing = { |
| 15 | + name: 'stoaiconfig' |
| 16 | +} |
| 17 | + |
| 18 | +resource webApp 'Microsoft.Web/sites@2024-04-01' = { |
| 19 | + name: siteName |
| 20 | + location: 'swedencentral' |
| 21 | + identity: { |
| 22 | + type: 'SystemAssigned' |
| 23 | + } |
| 24 | + properties: { |
| 25 | + httpsOnly: true |
| 26 | + publicNetworkAccess: 'Enabled' |
| 27 | + serverFarmId: appServicePlan.id |
| 28 | + siteConfig: { |
| 29 | + linuxFxVersion: 'SITECONTAINERS' |
| 30 | + alwaysOn: true |
| 31 | + ftpsState: 'Disabled' |
| 32 | + minTlsVersion: '1.2' |
| 33 | + minimumElasticInstanceCount: 1 |
| 34 | + } |
| 35 | + } |
| 36 | + |
| 37 | + resource settings 'config@2024-04-01' = { |
| 38 | + name: 'appsettings' |
| 39 | + properties: { |
| 40 | + DEFAULT_LOCALE: 'en' |
| 41 | + JWT_SECRET: jwtSecret |
| 42 | + SESSION_SECRET: sessionSecret |
| 43 | + PROXY_TARGET: 'http://localhost:8080' |
| 44 | + WEBUI_URL: 'https://${siteName}.azurewebsites.net' |
| 45 | + WEBUI_AUTH_TRUSTED_EMAIL_HEADER: 'X-User-Email' |
| 46 | + WEBUI_AUTH_TRUSTED_NAME_HEADER: 'X-User-Name' |
| 47 | + WEBUI_AUTH_TRUSTED_GROUPS_HEADER: 'X-User-Groups' |
| 48 | + } |
| 49 | + } |
| 50 | + |
| 51 | + resource storageSetting 'config@2024-11-01' = { |
| 52 | + name: 'azurestorageaccounts' |
| 53 | + properties: { |
| 54 | + config: { |
| 55 | + type: 'AzureFiles' |
| 56 | + shareName: 'openwebui' |
| 57 | + mountPath: '/app/backend/data' |
| 58 | + accountName: storageAccount.name |
| 59 | + accessKey: storageAccount.listKeys().keys[0].value |
| 60 | + } |
| 61 | + users: { |
| 62 | + type: 'AzureFiles' |
| 63 | + shareName: 'users' |
| 64 | + mountPath: '/app/data' |
| 65 | + accountName: storageAccount.name |
| 66 | + accessKey: storageAccount.listKeys().keys[0].value |
| 67 | + } |
| 68 | + } |
| 69 | + } |
| 70 | +} |
| 71 | + |
| 72 | +resource registry 'Microsoft.ContainerRegistry/registries@2024-11-01-preview' existing = { |
| 73 | + name: 'acrars2025' |
| 74 | +} |
| 75 | + |
| 76 | +resource registryPullAssignmentManagedIdentity 'Microsoft.Authorization/roleAssignments@2022-04-01' = { |
| 77 | + name: guid(registry.id, webApp.name, '-pull') |
| 78 | + scope: registry |
| 79 | + properties: { |
| 80 | + principalId: webApp.identity.principalId |
| 81 | + principalType: 'ServicePrincipal' |
| 82 | + roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', '7f951dda-4ed3-4680-a7ca-43fe172d538d') |
| 83 | + } |
| 84 | +} |
| 85 | + |
| 86 | +resource autoProxyApp 'Microsoft.Web/sites/sitecontainers@2024-11-01' = { |
| 87 | + name: 'auth-proxy' |
| 88 | + parent: webApp |
| 89 | + properties: { |
| 90 | + image: 'acrars2025.azurecr.io/openwebui-auth-proxy:latest' |
| 91 | + authType: 'SystemIdentity' |
| 92 | + isMain: true |
| 93 | + targetPort: '3000' |
| 94 | + inheritAppSettingsAndConnectionStrings: true |
| 95 | + environmentVariables: [ |
| 96 | + { |
| 97 | + name: 'PROXY_TARGET' |
| 98 | + value: 'PROXY_TARGET' |
| 99 | + } |
| 100 | + { |
| 101 | + name: 'JWT_SECRET' |
| 102 | + value: 'JWT_SECRET' |
| 103 | + } |
| 104 | + { |
| 105 | + name: 'SESSION_SECRET' |
| 106 | + value: 'SESSION_SECRET' |
| 107 | + } |
| 108 | + ] |
| 109 | + // volumeMounts: [ |
| 110 | + // { |
| 111 | + // volumeSubPath: '/app/data' |
| 112 | + // containerMountPath: '/app/data' |
| 113 | + // } |
| 114 | + // ] |
| 115 | + } |
| 116 | + |
| 117 | + dependsOn: [ |
| 118 | + registryPullAssignmentManagedIdentity |
| 119 | + ] |
| 120 | +} |
| 121 | + |
| 122 | + |
| 123 | +resource openwebuiApp 'Microsoft.Web/sites/sitecontainers@2024-11-01' = { |
| 124 | + name: 'open-webui' |
| 125 | + parent: webApp |
| 126 | + properties: { |
| 127 | + image: 'ghcr.io/open-webui/open-webui:main' |
| 128 | + isMain: false |
| 129 | + inheritAppSettingsAndConnectionStrings: true |
| 130 | + environmentVariables: [ |
| 131 | + { |
| 132 | + name: 'WEBUI_URL' |
| 133 | + value: 'WEBUI_URL' |
| 134 | + } |
| 135 | + { |
| 136 | + name: 'DEFAULT_LOCALE' |
| 137 | + value: 'DEFAULT_LOCALE' |
| 138 | + } |
| 139 | + { |
| 140 | + name: 'WEBUI_AUTH_TRUSTED_EMAIL_HEADER' |
| 141 | + value: 'WEBUI_AUTH_TRUSTED_EMAIL_HEADER' |
| 142 | + } |
| 143 | + { |
| 144 | + name: 'WEBUI_AUTH_TRUSTED_NAME_HEADER' |
| 145 | + value: 'WEBUI_AUTH_TRUSTED_NAME_HEADER' |
| 146 | + } |
| 147 | + { |
| 148 | + name: 'WEBUI_AUTH_TRUSTED_GROUPS_HEADER' |
| 149 | + value: 'WEBUI_AUTH_TRUSTED_GROUPS_HEADER' |
| 150 | + } |
| 151 | + ] |
| 152 | + // volumeMounts: [ |
| 153 | + // { |
| 154 | + // volumeSubPath: '/app/backend/data' |
| 155 | + // containerMountPath: '/app/backend/data' |
| 156 | + // } |
| 157 | + // ] |
| 158 | + } |
| 159 | + |
| 160 | + dependsOn: [ |
| 161 | + autoProxyApp |
| 162 | + ] |
| 163 | +} |
0 commit comments