Skip to content

Commit 3c299e6

Browse files
chore: add iac and config (#10)
1 parent bdba184 commit 3c299e6

12 files changed

+612
-2
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
##
44
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
55

6+
## Azure Developer CLI output
7+
.azure/
8+
.azure/**
9+
610
# User-specific files
711
*.rsuser
812
*.suo

azure.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: azure-openai-assistant-javascript@1.0.0
2+
services:
3+
webapp:
4+
project: ./
5+
dist: dist
6+
language: js
7+
host: staticwebapp
8+
hooks:
9+
predeploy:
10+
windows:
11+
shell: pwsh
12+
run: npm run build
13+
interactive: false
14+
continueOnError: false
15+
posix:
16+
shell: sh
17+
run: npm run build
18+
interactive: false
19+
continueOnError: false

infra/abbreviations.json

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
{
2+
"analysisServicesServers": "as",
3+
"apiManagementService": "apim-",
4+
"appConfigurationConfigurationStores": "appcs-",
5+
"appManagedEnvironments": "cae-",
6+
"appContainerApps": "ca-",
7+
"authorizationPolicyDefinitions": "policy-",
8+
"automationAutomationAccounts": "aa-",
9+
"blueprintBlueprints": "bp-",
10+
"blueprintBlueprintsArtifacts": "bpa-",
11+
"cacheRedis": "redis-",
12+
"cdnProfiles": "cdnp-",
13+
"cdnProfilesEndpoints": "cdne-",
14+
"cognitiveServicesAccounts": "cog-",
15+
"cognitiveServicesFormRecognizer": "cog-fr-",
16+
"cognitiveServicesTextAnalytics": "cog-ta-",
17+
"computeAvailabilitySets": "avail-",
18+
"computeCloudServices": "cld-",
19+
"computeDiskEncryptionSets": "des",
20+
"computeDisks": "disk",
21+
"computeDisksOs": "osdisk",
22+
"computeGalleries": "gal",
23+
"computeSnapshots": "snap-",
24+
"computeVirtualMachines": "vm",
25+
"computeVirtualMachineScaleSets": "vmss-",
26+
"containerInstanceContainerGroups": "ci",
27+
"containerRegistryRegistries": "cr",
28+
"containerServiceManagedClusters": "aks-",
29+
"databricksWorkspaces": "dbw-",
30+
"dataFactoryFactories": "adf-",
31+
"dataLakeAnalyticsAccounts": "dla",
32+
"dataLakeStoreAccounts": "dls",
33+
"dataMigrationServices": "dms-",
34+
"dBforMySQLServers": "mysql-",
35+
"dBforPostgreSQLServers": "psql-",
36+
"devicesIotHubs": "iot-",
37+
"devicesProvisioningServices": "provs-",
38+
"devicesProvisioningServicesCertificates": "pcert-",
39+
"documentDBDatabaseAccounts": "cosmos-",
40+
"eventGridDomains": "evgd-",
41+
"eventGridDomainsTopics": "evgt-",
42+
"eventGridEventSubscriptions": "evgs-",
43+
"eventHubNamespaces": "evhns-",
44+
"eventHubNamespacesEventHubs": "evh-",
45+
"hdInsightClustersHadoop": "hadoop-",
46+
"hdInsightClustersHbase": "hbase-",
47+
"hdInsightClustersKafka": "kafka-",
48+
"hdInsightClustersMl": "mls-",
49+
"hdInsightClustersSpark": "spark-",
50+
"hdInsightClustersStorm": "storm-",
51+
"hybridComputeMachines": "arcs-",
52+
"insightsActionGroups": "ag-",
53+
"insightsComponents": "appi-",
54+
"keyVaultVaults": "kv-",
55+
"kubernetesConnectedClusters": "arck",
56+
"kustoClusters": "dec",
57+
"kustoClustersDatabases": "dedb",
58+
"logicIntegrationAccounts": "ia-",
59+
"logicWorkflows": "logic-",
60+
"machineLearningServicesWorkspaces": "mlw-",
61+
"managedIdentityUserAssignedIdentities": "id-",
62+
"managementManagementGroups": "mg-",
63+
"migrateAssessmentProjects": "migr-",
64+
"networkApplicationGateways": "agw-",
65+
"networkApplicationSecurityGroups": "asg-",
66+
"networkAzureFirewalls": "afw-",
67+
"networkBastionHosts": "bas-",
68+
"networkConnections": "con-",
69+
"networkDnsZones": "dnsz-",
70+
"networkExpressRouteCircuits": "erc-",
71+
"networkFirewallPolicies": "afwp-",
72+
"networkFirewallPoliciesWebApplication": "waf",
73+
"networkFirewallPoliciesRuleGroups": "wafrg",
74+
"networkFrontDoors": "fd-",
75+
"networkFrontdoorWebApplicationFirewallPolicies": "fdfp-",
76+
"networkLoadBalancersExternal": "lbe-",
77+
"networkLoadBalancersInternal": "lbi-",
78+
"networkLoadBalancersInboundNatRules": "rule-",
79+
"networkLocalNetworkGateways": "lgw-",
80+
"networkNatGateways": "ng-",
81+
"networkNetworkInterfaces": "nic-",
82+
"networkNetworkSecurityGroups": "nsg-",
83+
"networkNetworkSecurityGroupsSecurityRules": "nsgsr-",
84+
"networkNetworkWatchers": "nw-",
85+
"networkPrivateDnsZones": "pdnsz-",
86+
"networkPrivateLinkServices": "pl-",
87+
"networkPublicIPAddresses": "pip-",
88+
"networkPublicIPPrefixes": "ippre-",
89+
"networkRouteFilters": "rf-",
90+
"networkRouteTables": "rt-",
91+
"networkRouteTablesRoutes": "udr-",
92+
"networkTrafficManagerProfiles": "traf-",
93+
"networkVirtualNetworkGateways": "vgw-",
94+
"networkVirtualNetworks": "vnet-",
95+
"networkVirtualNetworksSubnets": "snet-",
96+
"networkVirtualNetworksVirtualNetworkPeerings": "peer-",
97+
"networkVirtualWans": "vwan-",
98+
"networkVpnGateways": "vpng-",
99+
"networkVpnGatewaysVpnConnections": "vcn-",
100+
"networkVpnGatewaysVpnSites": "vst-",
101+
"notificationHubsNamespaces": "ntfns-",
102+
"notificationHubsNamespacesNotificationHubs": "ntf-",
103+
"operationalInsightsWorkspaces": "log-",
104+
"portalDashboards": "dash-",
105+
"powerBIDedicatedCapacities": "pbi-",
106+
"purviewAccounts": "pview-",
107+
"recoveryServicesVaults": "rsv-",
108+
"resourcesResourceGroups": "rg-",
109+
"searchSearchServices": "srch-",
110+
"serviceBusNamespaces": "sb-",
111+
"serviceBusNamespacesQueues": "sbq-",
112+
"serviceBusNamespacesTopics": "sbt-",
113+
"serviceEndPointPolicies": "se-",
114+
"serviceFabricClusters": "sf-",
115+
"signalRServiceSignalR": "sigr",
116+
"sqlManagedInstances": "sqlmi-",
117+
"sqlServers": "sql-",
118+
"sqlServersDataWarehouse": "sqldw-",
119+
"sqlServersDatabases": "sqldb-",
120+
"sqlServersDatabasesStretch": "sqlstrdb-",
121+
"storageStorageAccounts": "st",
122+
"storageStorageAccountsVm": "stvm",
123+
"storSimpleManagers": "ssimp",
124+
"streamAnalyticsCluster": "asa-",
125+
"synapseWorkspaces": "syn",
126+
"synapseWorkspacesAnalyticsWorkspaces": "synw",
127+
"synapseWorkspacesSqlPoolsDedicated": "syndp",
128+
"synapseWorkspacesSqlPoolsSpark": "synsp",
129+
"timeSeriesInsightsEnvironments": "tsi-",
130+
"webServerFarms": "plan-",
131+
"webSitesAppService": "app-",
132+
"webSitesAppServiceEnvironment": "ase-",
133+
"webSitesFunctions": "func-",
134+
"webStaticSites": "stapp-"
135+
}

infra/core/ai/cognitiveservices.bicep

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
metadata description = 'Creates an Azure Cognitive Services instance.'
2+
param name string
3+
param location string = resourceGroup().location
4+
param tags object = {}
5+
@description('The custom subdomain name used to access the API. Defaults to the value of the name parameter.')
6+
param customSubDomainName string = name
7+
param deployments array = []
8+
param kind string = 'OpenAI'
9+
10+
@allowed([ 'Enabled', 'Disabled' ])
11+
param publicNetworkAccess string = 'Enabled'
12+
param sku object = {
13+
name: 'S0'
14+
}
15+
16+
param allowedIpRules array = []
17+
param networkAcls object = empty(allowedIpRules) ? {
18+
defaultAction: 'Allow'
19+
} : {
20+
ipRules: allowedIpRules
21+
defaultAction: 'Deny'
22+
}
23+
param disableLocalAuth bool = false
24+
25+
resource account 'Microsoft.CognitiveServices/accounts@2023-05-01' = {
26+
name: name
27+
location: location
28+
tags: tags
29+
kind: kind
30+
properties: {
31+
customSubDomainName: customSubDomainName
32+
publicNetworkAccess: publicNetworkAccess
33+
networkAcls: networkAcls
34+
disableLocalAuth: disableLocalAuth
35+
}
36+
sku: sku
37+
}
38+
39+
@batchSize(1)
40+
resource deployment 'Microsoft.CognitiveServices/accounts/deployments@2023-05-01' = [for deployment in deployments: {
41+
parent: account
42+
name: deployment.name
43+
properties: {
44+
model: deployment.model
45+
raiPolicyName: contains(deployment, 'raiPolicyName') ? deployment.raiPolicyName : null
46+
}
47+
sku: contains(deployment, 'sku') ? deployment.sku : {
48+
name: 'Standard'
49+
capacity: 20
50+
}
51+
}]
52+
53+
output endpoint string = account.properties.endpoint
54+
output id string = account.id
55+
output name string = account.name

infra/core/host/staticwebapp.bicep

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
metadata description = 'Creates an Azure Static Web Apps instance.'
2+
param name string
3+
param location string = resourceGroup().location
4+
param tags object = {}
5+
6+
param sku object = {
7+
name: 'Free'
8+
tier: 'Free'
9+
}
10+
11+
resource web 'Microsoft.Web/staticSites@2023-01-01' = {
12+
name: name
13+
location: location
14+
tags: tags
15+
sku: sku
16+
properties: {
17+
provider: 'Custom'
18+
}
19+
}
20+
21+
output name string = web.name
22+
output uri string = 'https://${web.properties.defaultHostname}'
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
metadata description = 'Creates an Azure AI Search instance.'
2+
param name string
3+
param location string = resourceGroup().location
4+
param tags object = {}
5+
6+
param sku object = {
7+
name: 'standard'
8+
}
9+
10+
param authOptions object = {}
11+
param disableLocalAuth bool = false
12+
param disabledDataExfiltrationOptions array = []
13+
param encryptionWithCmk object = {
14+
enforcement: 'Unspecified'
15+
}
16+
@allowed([
17+
'default'
18+
'highDensity'
19+
])
20+
param hostingMode string = 'default'
21+
param networkRuleSet object = {
22+
bypass: 'None'
23+
ipRules: []
24+
}
25+
param partitionCount int = 1
26+
@allowed([
27+
'enabled'
28+
'disabled'
29+
])
30+
param publicNetworkAccess string = 'enabled'
31+
param replicaCount int = 1
32+
@allowed([
33+
'disabled'
34+
'free'
35+
'standard'
36+
])
37+
param semanticSearch string = 'disabled'
38+
39+
var searchIdentityProvider = (sku.name == 'free') ? null : {
40+
type: 'SystemAssigned'
41+
}
42+
43+
resource search 'Microsoft.Search/searchServices@2021-04-01-preview' = {
44+
name: name
45+
location: location
46+
tags: tags
47+
// The free tier does not support managed identity
48+
identity: searchIdentityProvider
49+
properties: {
50+
authOptions: disableLocalAuth ? null : authOptions
51+
disableLocalAuth: disableLocalAuth
52+
disabledDataExfiltrationOptions: disabledDataExfiltrationOptions
53+
encryptionWithCmk: encryptionWithCmk
54+
hostingMode: hostingMode
55+
networkRuleSet: networkRuleSet
56+
partitionCount: partitionCount
57+
publicNetworkAccess: publicNetworkAccess
58+
replicaCount: replicaCount
59+
semanticSearch: semanticSearch
60+
}
61+
sku: sku
62+
}
63+
64+
output id string = search.id
65+
output endpoint string = 'https://${name}.search.windows.net/'
66+
output name string = search.name
67+
output principalId string = !empty(searchIdentityProvider) ? search.identity.principalId : ''
68+

infra/core/security/role.bicep

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
metadata description = 'Creates a role assignment for a service principal.'
2+
param principalId string
3+
4+
@allowed([
5+
'Device'
6+
'ForeignGroup'
7+
'Group'
8+
'ServicePrincipal'
9+
'User'
10+
])
11+
param principalType string = 'ServicePrincipal'
12+
param roleDefinitionId string
13+
14+
resource role 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
15+
name: guid(subscription().id, resourceGroup().id, principalId, roleDefinitionId)
16+
properties: {
17+
principalId: principalId
18+
principalType: principalType
19+
roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', roleDefinitionId)
20+
}
21+
}

0 commit comments

Comments
 (0)