|
| 1 | +@description('Name of the Static Web App') |
| 2 | +param staticWebAppName string = 'my-firewall-mon-web' |
| 3 | + |
| 4 | +@description('Name of the Application Insights instance') |
| 5 | +param appInsightsName string = 'firewall-mon-insights' |
| 6 | + |
| 7 | +@description('Name of the Azure Maps Account') |
| 8 | +param mapsAccountName string = 'firewall-mon-maps' |
| 9 | + |
| 10 | +@description('Name of the Azure OpenAI Account') |
| 11 | +param openAiAccountName string = 'firewall-mon-openai' |
| 12 | + |
| 13 | +@description('Name of the GPT-4o model deployment') |
| 14 | +param gpt4oDeploymentName string = 'gpt4o' |
| 15 | + |
| 16 | +@description('Location for Azure OpenAI resources') |
| 17 | +param openAiLocation string = 'eastus' // Choose a region where GPT-4o is available |
| 18 | + |
| 19 | +@description('Location for Application Insights') |
| 20 | +param location string = resourceGroup().location |
| 21 | + |
| 22 | +@description('Base deployment time for use with dateTimeAdd function') |
| 23 | +param baseTime string = utcNow() |
| 24 | + |
| 25 | +@description('The retention period in days for Application Insights data') |
| 26 | +param retentionInDays int = 90 |
| 27 | + |
| 28 | +@description('The Log Analytics workspace SKU') |
| 29 | +@allowed(['PerGB2018', 'Free', 'PerNode', 'Standard', 'Standalone', 'Premium']) |
| 30 | +param logAnalyticsSku string = 'PerGB2018' |
| 31 | + |
| 32 | +resource staticWebApp 'Microsoft.Web/staticSites@2023-01-01' = { |
| 33 | + name: staticWebAppName |
| 34 | + location: resourceGroup().location |
| 35 | + sku: { |
| 36 | + name: 'Standard' |
| 37 | + tier: 'Standard' |
| 38 | + } |
| 39 | + properties: { |
| 40 | + |
| 41 | + } |
| 42 | +} |
| 43 | + |
| 44 | +// Create Static Web App App Settings with Application Insights connection string |
| 45 | +resource staticWebAppSettings 'Microsoft.Web/staticSites/config@2023-01-01' = { |
| 46 | + parent: staticWebApp |
| 47 | + name: 'appsettings' |
| 48 | + properties: { |
| 49 | + // Application Insights settings |
| 50 | + APPLICATION_INSIGHTS_CONNECTION_STRING: appInsights.properties.ConnectionString |
| 51 | + APPLICATIONINSIGHTS_CONNECTION_STRING: appInsights.properties.ConnectionString |
| 52 | + |
| 53 | + // Azure Maps settings |
| 54 | + ip_api_key: mapsAccount.listKeys().primaryKey |
| 55 | + ip_throttling_calls: '1' |
| 56 | + ip_throttling_window_milliseconds: '1000' |
| 57 | + |
| 58 | + // Azure OpenAI settings |
| 59 | + aoai_api_key: openAiAccount.listKeys().key1 |
| 60 | + aoai_endpoint: openAiAccount.properties.endpoint |
| 61 | + aoai_deployment: gpt4oDeploymentName |
| 62 | + |
| 63 | + // Build date timestamp |
| 64 | + BUILD_DATE: baseTime |
| 65 | + } |
| 66 | +} |
| 67 | + |
| 68 | +// Create Log Analytics workspace for Application Insights |
| 69 | +resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2022-10-01' = { |
| 70 | + name: '${appInsightsName}-workspace' |
| 71 | + location: location |
| 72 | + properties: { |
| 73 | + sku: { |
| 74 | + name: logAnalyticsSku |
| 75 | + } |
| 76 | + retentionInDays: retentionInDays |
| 77 | + features: { |
| 78 | + enableLogAccessUsingOnlyResourcePermissions: true |
| 79 | + } |
| 80 | + } |
| 81 | +} |
| 82 | + |
| 83 | +// Create Application Insights resource |
| 84 | +resource appInsights 'Microsoft.Insights/components@2020-02-02' = { |
| 85 | + name: appInsightsName |
| 86 | + location: location |
| 87 | + kind: 'web' |
| 88 | + properties: { |
| 89 | + Application_Type: 'web' |
| 90 | + WorkspaceResourceId: logAnalyticsWorkspace.id |
| 91 | + RetentionInDays: retentionInDays |
| 92 | + IngestionMode: 'LogAnalytics' |
| 93 | + publicNetworkAccessForIngestion: 'Enabled' |
| 94 | + publicNetworkAccessForQuery: 'Enabled' |
| 95 | + } |
| 96 | +} |
| 97 | + |
| 98 | +// Create Azure Maps Account |
| 99 | +resource mapsAccount 'Microsoft.Maps/accounts@2023-06-01' = { |
| 100 | + name: mapsAccountName |
| 101 | + location: 'global' |
| 102 | + sku: { |
| 103 | + name: 'G2' // Using G2 SKU which is suitable for most applications |
| 104 | + } |
| 105 | + properties: { |
| 106 | + // Default properties |
| 107 | + } |
| 108 | +} |
| 109 | + |
| 110 | +// Create Azure OpenAI Account |
| 111 | +resource openAiAccount 'Microsoft.CognitiveServices/accounts@2024-10-01' = { |
| 112 | + name: openAiAccountName |
| 113 | + location: openAiLocation |
| 114 | + kind: 'OpenAI' |
| 115 | + sku: { |
| 116 | + name: 'S0' // Standard tier for Azure OpenAI |
| 117 | + } |
| 118 | + properties: { |
| 119 | + customSubDomainName: openAiAccountName |
| 120 | + publicNetworkAccess: 'Enabled' |
| 121 | + } |
| 122 | +} |
| 123 | + |
| 124 | +// Create GPT-4o model deployment |
| 125 | +resource gpt4oDeployment 'Microsoft.CognitiveServices/accounts/deployments@2024-10-01' = { |
| 126 | + parent: openAiAccount |
| 127 | + name: gpt4oDeploymentName |
| 128 | + sku: { |
| 129 | + name: 'Standard' |
| 130 | + capacity: 1 // Represents the amount of provisioned throughput |
| 131 | + } |
| 132 | + properties: { |
| 133 | + model: { |
| 134 | + format: 'OpenAI' |
| 135 | + name: 'gpt-4o' |
| 136 | + version: '2024-11-20' // Using the latest version available |
| 137 | + } |
| 138 | + } |
| 139 | +} |
| 140 | + |
| 141 | +// Output the Maps Account id for reference |
| 142 | +output mapsAccountId string = mapsAccount.id |
| 143 | + |
| 144 | +// Output Azure OpenAI account endpoint and deployment ID |
| 145 | +output openAiEndpoint string = openAiAccount.properties.endpoint |
| 146 | +output openAiDeploymentId string = gpt4oDeployment.id |
| 147 | + |
0 commit comments