Skip to content

Commit

Permalink
chore(infra): update to latest infra templates
Browse files Browse the repository at this point in the history
  • Loading branch information
sinedied committed Feb 29, 2024
1 parent b2a83c5 commit 8a940fb
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 24 deletions.
3 changes: 2 additions & 1 deletion infra/abbreviations.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"analysisServicesServers": "as",
"apiManagementService": "apim-",
"appConfigurationConfigurationStores": "appcs-",
"appConfigurationStores": "appcs-",
"appManagedEnvironments": "cae-",
"appContainerApps": "ca-",
"authorizationPolicyDefinitions": "policy-",
Expand Down Expand Up @@ -55,6 +55,7 @@
"kubernetesConnectedClusters": "arck",
"kustoClusters": "dec",
"kustoClustersDatabases": "dedb",
"loadTesting": "lt-",
"logicIntegrationAccounts": "ia-",
"logicWorkflows": "logic-",
"machineLearningServicesWorkspaces": "mlw-",
Expand Down
11 changes: 11 additions & 0 deletions infra/core/ai/cognitiveservices.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,21 @@ param tags object = {}
param customSubDomainName string = name
param deployments array = []
param kind string = 'OpenAI'

@allowed([ 'Enabled', 'Disabled' ])
param publicNetworkAccess string = 'Enabled'
param sku object = {
name: 'S0'
}

param allowedIpRules array = []
param networkAcls object = empty(allowedIpRules) ? {
defaultAction: 'Allow'
} : {
ipRules: allowedIpRules
defaultAction: 'Deny'
}

resource account 'Microsoft.CognitiveServices/accounts@2023-05-01' = {
name: name
location: location
Expand All @@ -19,6 +29,7 @@ resource account 'Microsoft.CognitiveServices/accounts@2023-05-01' = {
properties: {
customSubDomainName: customSubDomainName
publicNetworkAccess: publicNetworkAccess
networkAcls: networkAcls
}
sku: sku
}
Expand Down
4 changes: 2 additions & 2 deletions infra/core/host/container-app.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ module containerRegistryAccess '../security/registry-access.bicep' = if (usePriv
}
}

resource app 'Microsoft.App/containerApps@2023-04-01-preview' = {
resource app 'Microsoft.App/containerApps@2023-05-02-preview' = {
name: name
location: location
tags: tags
Expand Down Expand Up @@ -150,7 +150,7 @@ resource app 'Microsoft.App/containerApps@2023-04-01-preview' = {
}
}

resource containerAppsEnvironment 'Microsoft.App/managedEnvironments@2023-04-01-preview' existing = {
resource containerAppsEnvironment 'Microsoft.App/managedEnvironments@2023-05-01' existing = {
name: containerAppsEnvironmentName
}

Expand Down
2 changes: 1 addition & 1 deletion infra/core/host/container-apps-environment.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ param daprEnabled bool = false
@description('Name of the Log Analytics workspace')
param logAnalyticsWorkspaceName string

resource containerAppsEnvironment 'Microsoft.App/managedEnvironments@2023-04-01-preview' = {
resource containerAppsEnvironment 'Microsoft.App/managedEnvironments@2023-05-01' = {
name: name
location: location
tags: tags
Expand Down
2 changes: 2 additions & 0 deletions infra/core/host/container-apps.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ param tags object = {}
param containerAppsEnvironmentName string
param containerRegistryName string
param containerRegistryResourceGroupName string = ''
param containerRegistryAdminUserEnabled bool = false
param logAnalyticsWorkspaceName string
param applicationInsightsName string = ''

Expand All @@ -26,6 +27,7 @@ module containerRegistry 'container-registry.bicep' = {
params: {
name: containerRegistryName
location: location
adminUserEnabled: containerRegistryAdminUserEnabled
tags: tags
}
}
Expand Down
6 changes: 3 additions & 3 deletions infra/core/host/container-registry.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ param location string = resourceGroup().location
param tags object = {}

@description('Indicates whether admin user is enabled')
param adminUserEnabled bool = true
param adminUserEnabled bool = false

@description('Indicates whether anonymous pull is enabled')
param anonymousPullEnabled bool = false
Expand Down Expand Up @@ -34,8 +34,8 @@ param zoneRedundancy string = 'Disabled'
@description('The log analytics workspace ID used for logging and monitoring')
param workspaceId string = ''

// 2022-02-01-preview needed for anonymousPullEnabled
resource containerRegistry 'Microsoft.ContainerRegistry/registries@2022-02-01-preview' = {
// 2023-01-01-preview needed for anonymousPullEnabled
resource containerRegistry 'Microsoft.ContainerRegistry/registries@2023-01-01-preview' = {
name: name
location: location
tags: tags
Expand Down
5 changes: 2 additions & 3 deletions infra/core/monitor/applicationinsights.bicep
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
metadata description = 'Creates an Application Insights instance based on an existing Log Analytics workspace.'
param name string
param dashboardName string
param dashboardName string = ''
param location string = resourceGroup().location
param tags object = {}
param includeDashboard bool = true
param logAnalyticsWorkspaceId string

resource applicationInsights 'Microsoft.Insights/components@2020-02-02' = {
Expand All @@ -17,7 +16,7 @@ resource applicationInsights 'Microsoft.Insights/components@2020-02-02' = {
}
}

module applicationInsightsDashboard 'applicationinsights-dashboard.bicep' = if (includeDashboard) {
module applicationInsightsDashboard 'applicationinsights-dashboard.bicep' = if (!empty(dashboardName)) {
name: 'application-insights-dashboard'
params: {
name: dashboardName
Expand Down
14 changes: 5 additions & 9 deletions infra/core/monitor/monitoring.bicep
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
metadata description = 'Creates an Application Insights instance and a Log Analytics workspace.'
param logAnalyticsName string
param applicationInsightsName string
param applicationInsightsDashboardName string
param applicationInsightsDashboardName string = ''
param location string = resourceGroup().location
param tags object = {}
param includeDashboard bool = true

var useApplicationInsights = !empty(applicationInsightsName)

module logAnalytics 'loganalytics.bicep' = {
name: 'loganalytics'
Expand All @@ -17,20 +14,19 @@ module logAnalytics 'loganalytics.bicep' = {
}
}

module applicationInsights 'applicationinsights.bicep' = if (useApplicationInsights) {
module applicationInsights 'applicationinsights.bicep' = {
name: 'applicationinsights'
params: {
name: applicationInsightsName
location: location
tags: tags
dashboardName: applicationInsightsDashboardName
includeDashboard: includeDashboard
logAnalyticsWorkspaceId: logAnalytics.outputs.id
}
}

output applicationInsightsConnectionString string = useApplicationInsights ? applicationInsights.outputs.connectionString : ''
output applicationInsightsInstrumentationKey string = useApplicationInsights ? applicationInsights.outputs.instrumentationKey : ''
output applicationInsightsName string = useApplicationInsights ? applicationInsights.outputs.name : ''
output applicationInsightsConnectionString string = applicationInsights.outputs.connectionString
output applicationInsightsInstrumentationKey string = applicationInsights.outputs.instrumentationKey
output applicationInsightsName string = applicationInsights.outputs.name
output logAnalyticsWorkspaceId string = logAnalytics.outputs.id
output logAnalyticsWorkspaceName string = logAnalytics.outputs.name
13 changes: 9 additions & 4 deletions infra/core/search/search-services.bicep
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
metadata description = 'Creates an Azure Cognitive Search instance.'
metadata description = 'Creates an Azure AI Search instance.'
param name string
param location string = resourceGroup().location
param tags object = {}
Expand Down Expand Up @@ -36,13 +36,16 @@ param replicaCount int = 1
])
param semanticSearch string = 'disabled'

var searchIdentityProvider = (sku.name == 'free') ? null : {
type: 'SystemAssigned'
}

resource search 'Microsoft.Search/searchServices@2021-04-01-preview' = {
name: name
location: location
tags: tags
identity: {
type: 'SystemAssigned'
}
// The free tier does not support managed identity
identity: searchIdentityProvider
properties: {
authOptions: authOptions
disableLocalAuth: disableLocalAuth
Expand All @@ -61,3 +64,5 @@ resource search 'Microsoft.Search/searchServices@2021-04-01-preview' = {
output id string = search.id
output endpoint string = 'https://${name}.search.windows.net/'
output name string = search.name
output principalId string = !empty(searchIdentityProvider) ? search.identity.principalId : ''

2 changes: 1 addition & 1 deletion infra/core/security/registry-access.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ resource aksAcrPull 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
}
}

resource containerRegistry 'Microsoft.ContainerRegistry/registries@2022-02-01-preview' existing = {
resource containerRegistry 'Microsoft.ContainerRegistry/registries@2023-01-01-preview' existing = {
name: containerRegistryName
}
1 change: 1 addition & 0 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ module containerApps './core/host/container-apps.bicep' = {
location: location
tags: tags
logAnalyticsWorkspaceName: monitoring.outputs.logAnalyticsWorkspaceName
containerRegistryAdminUserEnabled: true
}
}

Expand Down

0 comments on commit 8a940fb

Please sign in to comment.