Skip to content

Commit c6d8703

Browse files
NirajC-MicrosoftPrajwal-MicrosoftPrekshith-Microsoft
authored
fix: Dev to main (#706)
* post deployment script changes * Updated the network module * script fix * update azure.yml * fix script 1 * Quotacheck fix (#701) --------- Co-authored-by: Prajwal-Microsoft <v-dcprajwal@microsoft.com> Co-authored-by: Prekshith D J (Persistent Systems Inc) <v-pdj@microsoft.com>
1 parent a957407 commit c6d8703

File tree

11 files changed

+586
-840
lines changed

11 files changed

+586
-840
lines changed

azure.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ hooks:
1616
Write-Host "Web app URL: "
1717
Write-Host "$env:WEB_APP_URL" -ForegroundColor Cyan
1818
Write-Host "`nRun the following command in your Bash terminal. It will grant the necessary permissions between resources and your user account, and also process and load the sample data into the application."
19-
Write-Host "bash ./infra/scripts/process_sample_data.sh" -ForegroundColor Cyan
19+
Write-Host "bash ./infra/scripts/process_sample_data.sh $env:AZURE_RESOURCE_GROUP" -ForegroundColor Cyan
2020
shell: pwsh
2121
continueOnError: false
2222
interactive: true
@@ -26,7 +26,7 @@ hooks:
2626
echo $WEB_APP_URL
2727
echo ""
2828
echo "Run the following command in your Bash terminal. It will grant the necessary permissions between resources and your user account, and also process and load the sample data into the application."
29-
echo "bash ./infra/scripts/process_sample_data.sh"
29+
echo "bash ./infra/scripts/process_sample_data.sh $env:AZURE_RESOURCE_GROUP"
3030
shell: sh
3131
continueOnError: false
3232
interactive: true

docs/AVMPostDeploymentGuide.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# AVM Post Deployment Guide
2+
This document provides guidance on post-deployment steps after deploying the Build Your Own Copilot Accelerator from the [AVM (Azure Verified Modules) repository](https://github.com/Azure/bicep-registry-modules/tree/main/avm/ptn/sa/build-your-own-copilot).
3+
4+
## Post Deployment Steps
5+
1. Clone the Repository
6+
First, clone this repository to access the post-deployment scripts:
7+
```bash
8+
git clone https://github.com/microsoft/Build-your-own-copilot-Solution-Accelerator.git
9+
```
10+
```bash
11+
cd Build-your-own-copilot-Solution-Accelerator
12+
```
13+
14+
2. Import Sample Data -Run bash command printed in the terminal. The bash command will look like the following:
15+
16+
```bash
17+
bash ./infra/scripts/process_sample_data.sh <resourceGroupName>
18+
```
19+
If the deployment does not exist or has been deleted – The script will prompt you to manually enter the required values
20+
21+
3. Add Authentication Provider
22+
23+
Follow steps in [App Authentication](https://github.com/microsoft/Build-your-own-copilot-Solution-Accelerator/blob/main/docs/AppAuthentication.md) to configure authentication in app service.
24+
>Note that Authentication changes can take up to 10 minutes.
25+
26+
4. Deleting Resources After a Failed Deployment
27+
28+
Follow steps in [Delete Resource Group](https://github.com/microsoft/Build-your-own-copilot-Solution-Accelerator/blob/main/docs/DeleteResourceGroup.md) if your deployment fails and/or you need to clean up the resources.
29+
30+
By following these steps, you’ll ensure a smooth transition from deployment to hands-on usage.

infra/main.bicep

Lines changed: 109 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ resource resourceGroupTags 'Microsoft.Resources/tags@2021-04-01' = {
272272
TemplateName: 'Client Advisor'
273273
Type: enablePrivateNetworking ? 'WAF' : 'Non-WAF'
274274
CreatedBy: createdBy
275+
DeploymentName: deployment().name
275276
}
276277
}
277278
}
@@ -386,22 +387,109 @@ module sqlUserAssignedIdentity 'br/public:avm/res/managed-identity/user-assigned
386387
}
387388
}
388389

389-
// ========== Network Module ========== //
390-
module network 'modules/network.bicep' = if (enablePrivateNetworking) {
391-
name: take('network-${solutionSuffix}-deployment', 64)
390+
// ========== Virtual Network and Networking Components ========== //
391+
392+
// Virtual Network with NSGs and Subnets
393+
module virtualNetwork 'modules/virtualNetwork.bicep' = if (enablePrivateNetworking) {
394+
name: take('module.virtualNetwork.${solutionSuffix}', 64)
392395
params: {
393-
resourcesName: solutionSuffix
394-
// logAnalyticsWorkSpaceResourceId: logAnalyticsWorkspace.outputs.resourceId
395-
logAnalyticsWorkSpaceResourceId: logAnalyticsWorkspaceResourceId
396-
vmAdminUsername: vmAdminUsername ?? 'JumpboxAdminUser'
397-
vmAdminPassword: vmAdminPassword ?? 'JumpboxAdminP@ssw0rd1234!'
398-
vmSize: vmSize ?? 'Standard_DS2_v2' // Default VM size
396+
name: 'vnet-${solutionSuffix}'
397+
addressPrefixes: ['10.0.0.0/20'] // 4096 addresses (enough for 8 /23 subnets or 16 /24)
399398
location: solutionLocation
400399
tags: allTags
400+
logAnalyticsWorkspaceId: logAnalyticsWorkspaceResourceId
401+
resourceSuffix: solutionSuffix
402+
enableTelemetry: enableTelemetry
403+
}
404+
}
405+
// Azure Bastion Host
406+
var bastionHostName = 'bas-${solutionSuffix}'
407+
module bastionHost 'br/public:avm/res/network/bastion-host:0.6.1' = if (enablePrivateNetworking) {
408+
name: take('avm.res.network.bastion-host.${bastionHostName}', 64)
409+
params: {
410+
name: bastionHostName
411+
skuName: 'Standard'
412+
location: solutionLocation
413+
virtualNetworkResourceId: virtualNetwork!.outputs.resourceId
414+
diagnosticSettings: [
415+
{
416+
name: 'bastionDiagnostics'
417+
workspaceResourceId: logAnalyticsWorkspaceResourceId
418+
logCategoriesAndGroups: [
419+
{
420+
categoryGroup: 'allLogs'
421+
enabled: true
422+
}
423+
]
424+
}
425+
]
426+
tags: tags
401427
enableTelemetry: enableTelemetry
428+
publicIPAddressObject: {
429+
name: 'pip-${bastionHostName}'
430+
zones: []
431+
}
402432
}
403433
}
404434

435+
// Jumpbox Virtual Machine
436+
var jumpboxVmName = take('vm-jumpbox-${solutionSuffix}', 15)
437+
module jumpboxVM 'br/public:avm/res/compute/virtual-machine:0.15.0' = if (enablePrivateNetworking) {
438+
name: take('avm.res.compute.virtual-machine.${jumpboxVmName}', 64)
439+
params: {
440+
name: take(jumpboxVmName, 15) // Shorten VM name to 15 characters to avoid Azure limits
441+
vmSize: vmSize ?? 'Standard_DS2_v2'
442+
location: solutionLocation
443+
adminUsername: vmAdminUsername ?? 'JumpboxAdminUser'
444+
adminPassword: vmAdminPassword ?? 'JumpboxAdminP@ssw0rd1234!'
445+
tags: tags
446+
zone: 0
447+
imageReference: {
448+
offer: 'WindowsServer'
449+
publisher: 'MicrosoftWindowsServer'
450+
sku: '2019-datacenter'
451+
version: 'latest'
452+
}
453+
osType: 'Windows'
454+
osDisk: {
455+
name: 'osdisk-${jumpboxVmName}'
456+
managedDisk: {
457+
storageAccountType: 'Standard_LRS'
458+
}
459+
}
460+
encryptionAtHost: false // Some Azure subscriptions do not support encryption at host
461+
nicConfigurations: [
462+
{
463+
name: 'nic-${jumpboxVmName}'
464+
ipConfigurations: [
465+
{
466+
name: 'ipconfig1'
467+
subnetResourceId: virtualNetwork!.outputs.jumpboxSubnetResourceId
468+
}
469+
]
470+
diagnosticSettings: [
471+
{
472+
name: 'jumpboxDiagnostics'
473+
workspaceResourceId: logAnalyticsWorkspaceResourceId
474+
logCategoriesAndGroups: [
475+
{
476+
categoryGroup: 'allLogs'
477+
enabled: true
478+
}
479+
]
480+
metricCategories: [
481+
{
482+
category: 'AllMetrics'
483+
enabled: true
484+
}
485+
]
486+
}
487+
]
488+
}
489+
]
490+
enableTelemetry: enableTelemetry
491+
}
492+
}
405493
// ========== Private DNS Zones ========== //
406494
var privateDnsZones = [
407495
'privatelink.cognitiveservices.azure.com'
@@ -455,8 +543,8 @@ module avmPrivateDnsZones 'br/public:avm/res/network/private-dns-zone:0.7.1' = [
455543
enableTelemetry: enableTelemetry
456544
virtualNetworkLinks: [
457545
{
458-
name: take('vnetlink-${network!.outputs.vnetName}-${split(zone, '.')[1]}', 80)
459-
virtualNetworkResourceId: network!.outputs.vnetResourceId
546+
name: take('vnetlink-${virtualNetwork!.outputs.name}-${split(zone, '.')[1]}', 80)
547+
virtualNetworkResourceId: virtualNetwork!.outputs.resourceId
460548
}
461549
]
462550
}
@@ -496,7 +584,7 @@ module keyvault 'br/public:avm/res/key-vault/vault:0.12.1' = {
496584
]
497585
}
498586
service: 'vault'
499-
subnetResourceId: network!.outputs.subnetPrivateEndpointsResourceId
587+
subnetResourceId: virtualNetwork!.outputs.pepsSubnetResourceId
500588
}
501589
]
502590
: []
@@ -637,7 +725,7 @@ module aiFoundryAiServices 'modules/ai-services.bicep' = if (aiFoundryAIservices
637725
{
638726
name: 'pep-${aiFoundryAiServicesResourceName}'
639727
customNetworkInterfaceName: 'nic-${aiFoundryAiServicesResourceName}'
640-
subnetResourceId: network!.outputs.subnetPrivateEndpointsResourceId
728+
subnetResourceId: virtualNetwork!.outputs.pepsSubnetResourceId
641729
privateDnsZoneGroup: {
642730
privateDnsZoneGroupConfigs: [
643731
{
@@ -744,7 +832,7 @@ module cosmosDb 'br/public:avm/res/document-db/database-account:0.15.0' = {
744832
]
745833
}
746834
service: 'Sql'
747-
subnetResourceId: network!.outputs.subnetPrivateEndpointsResourceId
835+
subnetResourceId: virtualNetwork!.outputs.pepsSubnetResourceId
748836
}
749837
]
750838
: []
@@ -817,7 +905,7 @@ module avmStorageAccount 'br/public:avm/res/storage/storage-account:0.20.0' = {
817905
}
818906
]
819907
}
820-
subnetResourceId: network!.outputs.subnetPrivateEndpointsResourceId
908+
subnetResourceId: virtualNetwork!.outputs.pepsSubnetResourceId
821909
service: 'blob'
822910
}
823911
{
@@ -830,7 +918,7 @@ module avmStorageAccount 'br/public:avm/res/storage/storage-account:0.20.0' = {
830918
}
831919
]
832920
}
833-
subnetResourceId: network!.outputs.subnetPrivateEndpointsResourceId
921+
subnetResourceId: virtualNetwork!.outputs.pepsSubnetResourceId
834922
service: 'queue'
835923
}
836924
]
@@ -939,7 +1027,7 @@ module sqlDBModule 'br/public:avm/res/sql/server:0.20.1' = {
9391027
]
9401028
}
9411029
service: 'sqlServer'
942-
subnetResourceId: network!.outputs.subnetPrivateEndpointsResourceId
1030+
subnetResourceId: virtualNetwork!.outputs.pepsSubnetResourceId
9431031
tags: tags
9441032
}
9451033
]
@@ -1062,7 +1150,7 @@ module webSite 'modules/web-sites.bicep' = {
10621150
// WAF aligned configuration for Private Networking
10631151
vnetRouteAllEnabled: enablePrivateNetworking ? true : false
10641152
vnetImagePullEnabled: enablePrivateNetworking ? true : false
1065-
virtualNetworkSubnetId: enablePrivateNetworking ? network!.outputs.subnetWebResourceId : null
1153+
virtualNetworkSubnetId: enablePrivateNetworking ? virtualNetwork!.outputs.webSubnetResourceId : null
10661154
publicNetworkAccess: 'Enabled'
10671155
}
10681156
}
@@ -1144,7 +1232,7 @@ module searchService 'br/public:avm/res/search/search-service:0.11.1' = {
11441232
]
11451233
}
11461234
service: 'searchService'
1147-
subnetResourceId: network!.outputs.subnetPrivateEndpointsResourceId
1235+
subnetResourceId: virtualNetwork!.outputs.pepsSubnetResourceId
11481236
}
11491237
]
11501238
: []
@@ -1381,5 +1469,5 @@ output USE_AI_PROJECT_CLIENT string = useAIProjectClientFlag
13811469
@description('Indicates whether the internal stream should be used.')
13821470
output USE_INTERNAL_STREAM string = useInternalStream
13831471

1384-
@description('The client ID of the managed identity.')
1385-
output AZURE_CLIENT_ID string = userAssignedIdentity.outputs.clientId
1472+
@description('The Azure Subscription ID where the resources are deployed.')
1473+
output AZURE_SUBSCRIPTION_ID string = subscription().subscriptionId

0 commit comments

Comments
 (0)