| 
5 | 5 |     "_generator": {  | 
6 | 6 |       "name": "bicep",  | 
7 | 7 |       "version": "0.35.1.17967",  | 
8 |  | -      "templateHash": "13536585236097147854"  | 
 | 8 | +      "templateHash": "6972576500861957783"  | 
9 | 9 |     }  | 
10 | 10 |   },  | 
11 | 11 |   "parameters": {  | 
 | 
89 | 89 |     "AZURE_LOCATION": {  | 
90 | 90 |       "type": "string",  | 
91 | 91 |       "defaultValue": ""  | 
 | 92 | +    },  | 
 | 93 | +    "existingLogAnalyticsWorkspaceId": {  | 
 | 94 | +      "type": "string",  | 
 | 95 | +      "defaultValue": "",  | 
 | 96 | +      "metadata": {  | 
 | 97 | +        "description": "Optional: Existing Log Analytics Workspace Resource ID"  | 
 | 98 | +      }  | 
92 | 99 |     }  | 
93 | 100 |   },  | 
94 | 101 |   "variables": {  | 
 | 
322 | 329 |     "abbrs": "[variables('$fxv#0')]",  | 
323 | 330 |     "solutionLocation": "[if(empty(parameters('AZURE_LOCATION')), resourceGroup().location, parameters('AZURE_LOCATION'))]",  | 
324 | 331 |     "uniqueId": "[toLower(uniqueString(parameters('environmentName'), subscription().id, variables('solutionLocation')))]",  | 
325 |  | -    "solutionPrefix": "[format('dg{0}', padLeft(take(variables('uniqueId'), 12), 12, '0'))]",  | 
326 |  | -    "baseUrl": "https://raw.githubusercontent.com/microsoft/document-generation-solution-accelerator/main/",  | 
327 |  | -    "ApplicationInsightsName": "[format('{0}{1}', variables('abbrs').managementGovernance.applicationInsights, variables('solutionPrefix'))]",  | 
328 |  | -    "WorkspaceName": "[format('{0}{1}', variables('abbrs').managementGovernance.logAnalyticsWorkspace, variables('solutionPrefix'))]"  | 
 | 332 | +    "solutionPrefix": "[format('dg{0}', padLeft(take(variables('uniqueId'), 12), 12, '0'))]"  | 
329 | 333 |   },  | 
330 | 334 |   "resources": [  | 
331 |  | -    {  | 
332 |  | -      "type": "Microsoft.OperationalInsights/workspaces",  | 
333 |  | -      "apiVersion": "2020-08-01",  | 
334 |  | -      "name": "[variables('WorkspaceName')]",  | 
335 |  | -      "location": "[variables('solutionLocation')]",  | 
336 |  | -      "properties": {  | 
337 |  | -        "sku": {  | 
338 |  | -          "name": "PerGB2018"  | 
339 |  | -        },  | 
340 |  | -        "retentionInDays": 30  | 
341 |  | -      }  | 
342 |  | -    },  | 
343 |  | -    {  | 
344 |  | -      "type": "Microsoft.Insights/components",  | 
345 |  | -      "apiVersion": "2020-02-02",  | 
346 |  | -      "name": "[variables('ApplicationInsightsName')]",  | 
347 |  | -      "location": "[variables('solutionLocation')]",  | 
348 |  | -      "tags": {  | 
349 |  | -        "[format('hidden-link:{0}', resourceId('Microsoft.Web/sites', variables('ApplicationInsightsName')))]": "Resource"  | 
350 |  | -      },  | 
351 |  | -      "properties": {  | 
352 |  | -        "Application_Type": "web",  | 
353 |  | -        "WorkspaceResourceId": "[resourceId('Microsoft.OperationalInsights/workspaces', variables('WorkspaceName'))]"  | 
354 |  | -      },  | 
355 |  | -      "kind": "web",  | 
356 |  | -      "dependsOn": [  | 
357 |  | -        "[resourceId('Microsoft.OperationalInsights/workspaces', variables('WorkspaceName'))]"  | 
358 |  | -      ]  | 
359 |  | -    },  | 
360 | 335 |     {  | 
361 | 336 |       "type": "Microsoft.Resources/deployments",  | 
362 | 337 |       "apiVersion": "2022-09-01",  | 
 | 
610 | 585 |           },  | 
611 | 586 |           "managedIdentityObjectId": {  | 
612 | 587 |             "value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_managed_identity'), '2022-09-01').outputs.managedIdentityOutput.value.objectId]"  | 
 | 588 | +          },  | 
 | 589 | +          "existingLogAnalyticsWorkspaceId": {  | 
 | 590 | +            "value": "[parameters('existingLogAnalyticsWorkspaceId')]"  | 
613 | 591 |           }  | 
614 | 592 |         },  | 
615 | 593 |         "template": {  | 
 | 
619 | 597 |             "_generator": {  | 
620 | 598 |               "name": "bicep",  | 
621 | 599 |               "version": "0.35.1.17967",  | 
622 |  | -              "templateHash": "6302547316976018886"  | 
 | 600 | +              "templateHash": "10562656740645209068"  | 
623 | 601 |             }  | 
624 | 602 |           },  | 
625 | 603 |           "parameters": {  | 
 | 
652 | 630 |             },  | 
653 | 631 |             "managedIdentityObjectId": {  | 
654 | 632 |               "type": "string"  | 
 | 633 | +            },  | 
 | 634 | +            "existingLogAnalyticsWorkspaceId": {  | 
 | 635 | +              "type": "string",  | 
 | 636 | +              "defaultValue": ""  | 
655 | 637 |             }  | 
656 | 638 |           },  | 
657 | 639 |           "variables": {  | 
 | 
897 | 879 |             "aiProjectFriendlyName": "[variables('aiProjectName')]",  | 
898 | 880 |             "aiSearchName": "[format('{0}{1}', variables('abbrs').ai.aiSearch, parameters('solutionName'))]",  | 
899 | 881 |             "workspaceName": "[format('{0}{1}', variables('abbrs').managementGovernance.logAnalyticsWorkspace, parameters('solutionName'))]",  | 
 | 882 | +            "useExisting": "[not(empty(parameters('existingLogAnalyticsWorkspaceId')))]",  | 
 | 883 | +            "existingLawResourceGroup": "[if(variables('useExisting'), split(parameters('existingLogAnalyticsWorkspaceId'), '/')[4], '')]",  | 
 | 884 | +            "existingLawName": "[if(variables('useExisting'), split(parameters('existingLogAnalyticsWorkspaceId'), '/')[8], '')]",  | 
900 | 885 |             "aiModelDeployments": [  | 
901 | 886 |               {  | 
902 | 887 |                 "name": "[parameters('gptModelName')]",  | 
 | 
905 | 890 |                   "name": "[parameters('deploymentType')]",  | 
906 | 891 |                   "capacity": "[parameters('gptDeploymentCapacity')]"  | 
907 | 892 |                 },  | 
 | 893 | +                "version": "2024-05-13",  | 
908 | 894 |                 "raiPolicyName": "Microsoft.Default"  | 
909 | 895 |               },  | 
910 | 896 |               {  | 
 | 
914 | 900 |                   "name": "Standard",  | 
915 | 901 |                   "capacity": "[parameters('embeddingDeploymentCapacity')]"  | 
916 | 902 |                 },  | 
 | 903 | +                "version": "2",  | 
917 | 904 |                 "raiPolicyName": "Microsoft.Default"  | 
918 | 905 |               }  | 
919 | 906 |             ],  | 
 | 
971 | 958 |               ]  | 
972 | 959 |             },  | 
973 | 960 |             {  | 
 | 961 | +              "condition": "[not(variables('useExisting'))]",  | 
974 | 962 |               "type": "Microsoft.OperationalInsights/workspaces",  | 
975 | 963 |               "apiVersion": "2023-09-01",  | 
976 | 964 |               "name": "[variables('workspaceName')]",  | 
 | 
993 | 981 |                 "Application_Type": "web",  | 
994 | 982 |                 "publicNetworkAccessForIngestion": "Enabled",  | 
995 | 983 |                 "publicNetworkAccessForQuery": "Enabled",  | 
996 |  | -                "WorkspaceResourceId": "[resourceId('Microsoft.OperationalInsights/workspaces', variables('workspaceName'))]"  | 
 | 984 | +                "WorkspaceResourceId": "[if(variables('useExisting'), extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, variables('existingLawResourceGroup')), 'Microsoft.OperationalInsights/workspaces', variables('existingLawName')), resourceId('Microsoft.OperationalInsights/workspaces', variables('workspaceName')))]"  | 
997 | 985 |               },  | 
998 | 986 |               "dependsOn": [  | 
999 | 987 |                 "[resourceId('Microsoft.OperationalInsights/workspaces', variables('workspaceName'))]"  | 
 | 
1059 | 1047 |               "properties": {  | 
1060 | 1048 |                 "model": {  | 
1061 | 1049 |                   "format": "OpenAI",  | 
1062 |  | -                  "name": "[variables('aiModelDeployments')[copyIndex()].model]"  | 
 | 1050 | +                  "name": "[variables('aiModelDeployments')[copyIndex()].model]",  | 
 | 1051 | +                  "version": "[variables('aiModelDeployments')[copyIndex()].version]"  | 
1063 | 1052 |                 },  | 
1064 |  | -                "raiPolicyName": "[variables('aiModelDeployments')[copyIndex()].raiPolicyName]"  | 
 | 1053 | +                "raiPolicyName": "[variables('aiModelDeployments')[copyIndex()].raiPolicyName]",  | 
 | 1054 | +                "versionUpgradeOption": "OnceCurrentVersionExpired"  | 
1065 | 1055 |               },  | 
1066 | 1056 |               "sku": {  | 
1067 | 1057 |                 "name": "[variables('aiModelDeployments')[copyIndex()].sku.name]",  | 
 | 
1399 | 1389 |             },  | 
1400 | 1390 |             "logAnalyticsWorkspaceResourceName": {  | 
1401 | 1391 |               "type": "string",  | 
1402 |  | -              "value": "[variables('workspaceName')]"  | 
 | 1392 | +              "value": "[if(variables('useExisting'), variables('existingLawName'), variables('workspaceName'))]"  | 
1403 | 1393 |             },  | 
1404 | 1394 |             "storageAccountName": {  | 
1405 | 1395 |               "type": "string",  | 
1406 | 1396 |               "value": "[variables('storageNameCleaned')]"  | 
 | 1397 | +            },  | 
 | 1398 | +            "applicationInsightsConnectionString": {  | 
 | 1399 | +              "type": "string",  | 
 | 1400 | +              "value": "[reference(resourceId('Microsoft.Insights/components', variables('applicationInsightsName')), '2020-02-02').ConnectionString]"  | 
1407 | 1401 |             }  | 
1408 | 1402 |           }  | 
1409 | 1403 |         }  | 
 | 
1667 | 1661 |           "AZURE_COSMOSDB_DATABASE": {  | 
1668 | 1662 |             "value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_cosmos_db'), '2022-09-01').outputs.cosmosDatabaseName.value]"  | 
1669 | 1663 |           },  | 
 | 1664 | +          "appInsightsConnectionString": {  | 
 | 1665 | +            "value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_ai_foundry'), '2022-09-01').outputs.applicationInsightsConnectionString.value]"  | 
 | 1666 | +          },  | 
1670 | 1667 |           "AZURE_COSMOSDB_ENABLE_FEEDBACK": {  | 
1671 | 1668 |             "value": "True"  | 
1672 | 1669 |           },  | 
 | 
1684 | 1681 |             "_generator": {  | 
1685 | 1682 |               "name": "bicep",  | 
1686 | 1683 |               "version": "0.35.1.17967",  | 
1687 |  | -              "templateHash": "2607460382594511507"  | 
 | 1684 | +              "templateHash": "16988932665267526316"  | 
1688 | 1685 |             }  | 
1689 | 1686 |           },  | 
1690 | 1687 |           "parameters": {  | 
 | 
1907 | 1904 |             },  | 
1908 | 1905 |             "applicationInsightsId": {  | 
1909 | 1906 |               "type": "string"  | 
 | 1907 | +            },  | 
 | 1908 | +            "appInsightsConnectionString": {  | 
 | 1909 | +              "type": "securestring",  | 
 | 1910 | +              "metadata": {  | 
 | 1911 | +                "description": "The Application Insights connection string"  | 
 | 1912 | +              }  | 
1910 | 1913 |             }  | 
1911 | 1914 |           },  | 
1912 | 1915 |           "variables": {  | 
 | 
1971 | 1974 |                       "name": "APPINSIGHTS_INSTRUMENTATIONKEY",  | 
1972 | 1975 |                       "value": "[reference(parameters('applicationInsightsId'), '2015-05-01').InstrumentationKey]"  | 
1973 | 1976 |                     },  | 
 | 1977 | +                    {  | 
 | 1978 | +                      "name": "APPLICATIONINSIGHTS_CONNECTION_STRING",  | 
 | 1979 | +                      "value": "[parameters('appInsightsConnectionString')]"  | 
 | 1980 | +                    },  | 
1974 | 1981 |                     {  | 
1975 | 1982 |                       "name": "AZURE_SEARCH_SERVICE",  | 
1976 | 1983 |                       "value": "[parameters('aiSearchService')]"  | 
 | 
0 commit comments