Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complex adjoin pw #526

Closed
wants to merge 15 commits into from
Closed
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,8 @@ Deploy-Baseline.ps1
workload/bicep/parameters/deploy-baseline-parameters-MSA.json

# local test files
localTest
localTest

# Ignore files that might be used for local testing
/workload/bicep/*.json
/workload/bicep/*.bicepparam
26 changes: 14 additions & 12 deletions workload/bicep/deploy-baseline.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,6 @@ var varSessionHostLocationAcronym = varLocations[varSessionHostLocationLowercase
var varManagementPlaneLocationAcronym = varLocations[varManagementPlaneLocationLowercase].acronym
var varLocations = loadJsonContent('../variables/locations.json')
var varTimeZoneSessionHosts = varLocations[varSessionHostLocationLowercase].timeZone
var varTimeZoneManagementPlane = varLocations[varManagementPlaneLocationLowercase].timeZone
var varManagementPlaneNamingStandard = '${varDeploymentPrefixLowercase}-${varDeploymentEnvironmentLowercase}-${varManagementPlaneLocationAcronym}'
var varComputeStorageResourcesNamingStandard = '${varDeploymentPrefixLowercase}-${varDeploymentEnvironmentLowercase}-${varSessionHostLocationAcronym}'
var varDiskEncryptionSetName = avdUseCustomNaming ? '${ztDiskEncryptionSetCustomNamePrefix}-${varComputeStorageResourcesNamingStandard}-001' : 'des-zt-${varComputeStorageResourcesNamingStandard}-001'
Expand Down Expand Up @@ -537,11 +536,11 @@ var varZtKvName = avdUseCustomNaming ? '${ztKvPrefixCustomName}-${varComputeStor
var varZtKvPrivateEndpointName = 'pe-${varZtKvName}-vault'
//
var varFslogixSharePath = '\\\\${varFslogixStorageName}.file.${environment().suffixes.storage}\\${varFslogixFileShareName}'
var varBaseScriptUri = 'https://raw.githubusercontent.com/Azure/avdaccelerator/main/workload/'
var varSessionHostConfigurationScriptUri = '${varBaseScriptUri}scripts/Set-SessionHostConfiguration.ps1'
var varSessionHostConfigurationScript = './Set-SessionHostConfiguration.ps1'
var varBaseScriptUri = 'https://raw.githubusercontent.com/Azure/avdaccelerator/complex-adjoin-pw/workload/'
var varSessionHostConfigurationScriptFileName = 'Set-SessionHostConfiguration.ps1'
var varSessionHostConfigurationScriptUri = '${varBaseScriptUri}scripts/${varSessionHostConfigurationScriptFileName}'
var varSessionHostConfigurationScript = './${varSessionHostConfigurationScriptFileName}'
var varDiskEncryptionKeyExpirationInEpoch = dateTimeToEpoch(dateTimeAdd(time, 'P${string(diskEncryptionKeyExpirationInDays)}D'))
var varAvdAgentPackageLocation = 'https://wvdportalstorageblob.blob.${environment().suffixes.storage}/galleryartifacts/Configuration_09-08-2022.zip'
var varCreateStorageDeployment = (createAvdFslogixDeployment || createMsixDeployment == true) ? true : false
var varFslogixStorageSku = zoneRedundantStorage ? '${fslogixStoragePerformance}_ZRS' : '${fslogixStoragePerformance}_LRS'
var varMsixStorageSku = zoneRedundantStorage ? '${msixStoragePerformance}_ZRS' : '${msixStoragePerformance}_LRS'
Expand Down Expand Up @@ -753,9 +752,11 @@ var varMarketPlaceGalleryWindows = {
version: 'latest'
}
}
var varStorageAzureFilesDscAgentPackageLocation = 'https://github.com/Azure/avdaccelerator/raw/main/workload/scripts/DSCStorageScripts.zip'
var varStorageToDomainScriptUri = '${varBaseScriptUri}scripts/Manual-DSC-Storage-Scripts.ps1'
var varStorageToDomainScript = './Manual-DSC-Storage-Scripts.ps1'

var varStorageAzureFilesDscAgentPackageLocation = '${varBaseScriptUri}scripts/DSCStorageScripts.zip'
var varStorageToDomainScriptFileName = 'Manual-DSC-Storage-Scripts.ps1'
var varStorageToDomainScriptUri = '${varBaseScriptUri}scripts/${varStorageToDomainScriptFileName}'
var varStorageToDomainScript = './${varStorageToDomainScriptFileName}'
var varOuStgPath = !empty(storageOuPath) ? '"${storageOuPath}"' : '"${varDefaultStorageOuPath}"'
var varDefaultStorageOuPath = (avdIdentityServiceProvider == 'AADDS') ? 'AADDC Computers' : 'Computers'
var varStorageCustomOuPath = !empty(storageOuPath) ? 'true' : 'false'
Expand Down Expand Up @@ -913,6 +914,7 @@ module networking './modules/networking/deploy.bicep' = if (createAvdVnet || cre
vnetPeeringName: varVnetPeeringName
remoteVnetPeeringName: varRemoteVnetPeeringName
vnetAvdSubnetName: varVnetAvdSubnetName
existingPeSubnetResourceId: existingVnetPrivateEndpointSubnetResourceId
vnetPrivateEndpointSubnetName: varVnetPrivateEndpointSubnetName
createVnetPeering: varCreateVnetPeering
deployPrivateEndpointSubnet: (deployPrivateEndpointKeyvaultStorage == true) ? true : false //adding logic that will be used when also including AVD control plane PEs
Expand Down Expand Up @@ -960,7 +962,7 @@ module managementPLane './modules/avdManagementPlane/deploy.bicep' = {
startVmOnConnect: (avdHostPoolType == 'Pooled') ? avdDeployScalingPlan : avdStartVmOnConnect
workloadSubsId: avdWorkloadSubsId
identityServiceProvider: avdIdentityServiceProvider
securityPrincipalIds: !empty(securityPrincipalId)? array(securityPrincipalId): []
securityPrincipalIds: !empty(securityPrincipalId) ? array(securityPrincipalId) : []
tags: createResourceTags ? union(varCustomResourceTags, varAvdDefaultTags) : varAvdDefaultTags
alaWorkspaceResourceId: avdDeployMonitoring ? (deployAlaWorkspace ? monitoringDiagnosticSettings.outputs.avdAlaWorkspaceResourceId : alaExistingWorkspaceResourceId) : ''
hostPoolAgentUpdateSchedule: varHostPoolAgentUpdateSchedule
Expand All @@ -987,7 +989,7 @@ module identity './modules/identity/deploy.bicep' = {
enableStartVmOnConnect: avdStartVmOnConnect
identityServiceProvider: avdIdentityServiceProvider
createStorageDeployment: varCreateStorageDeployment
securityPrincipalIds: !empty(securityPrincipalId)? array(securityPrincipalId): []
securityPrincipalIds: !empty(securityPrincipalId) ? array(securityPrincipalId) : []
tags: createResourceTags ? union(varCustomResourceTags, varAvdDefaultTags) : varAvdDefaultTags
}
dependsOn: [
Expand Down Expand Up @@ -1167,7 +1169,7 @@ module fslogixAzureFilesStorage './modules/storageAzureFiles/deploy.bicep' = if
deployPrivateEndpoint: deployPrivateEndpointKeyvaultStorage
ouStgPath: varOuStgPath
managedIdentityClientId: varCreateStorageDeployment ? identity.outputs.managedIdentityStorageClientId : ''
securityPrincipalName: !empty(securityPrincipalName)? securityPrincipalName: ''
securityPrincipalName: !empty(securityPrincipalName) ? securityPrincipalName : ''
domainJoinUserName: avdDomainJoinUserName
wrklKvName: varWrklKvName
serviceObjectsRgName: varServiceObjectsRgName
Expand Down Expand Up @@ -1210,7 +1212,7 @@ module msixAzureFilesStorage './modules/storageAzureFiles/deploy.bicep' = if (cr
deployPrivateEndpoint: deployPrivateEndpointKeyvaultStorage
ouStgPath: varOuStgPath
managedIdentityClientId: varCreateStorageDeployment ? identity.outputs.managedIdentityStorageClientId : ''
securityPrincipalName: !empty(securityPrincipalName)? securityPrincipalName: ''
securityPrincipalName: !empty(securityPrincipalName) ? securityPrincipalName : ''
domainJoinUserName: avdDomainJoinUserName
wrklKvName: varWrklKvName
serviceObjectsRgName: varServiceObjectsRgName
Expand Down
8 changes: 8 additions & 0 deletions workload/bicep/modules/networking/deploy.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ param deployAsg bool
@sys.description('Existing virtual network subnet for AVD.')
param existingAvdSubnetResourceId string

@sys.description('Existing virtual network subnet for private endpoints.')
param existingPeSubnetResourceId string

@sys.description('Resource Group Name for the AVD session hosts')
param computeObjectsRgName string

Expand Down Expand Up @@ -105,11 +108,16 @@ var varVirtualNetworkLogsDiagnostic = varAzureCloudName == 'AzureUSGovernment' ?
var varVirtualNetworkMetricsDiagnostic = [
'AllMetrics'
]

var varCreateAvdStaicRoute = true
var varExistingAvdVnetSubId = !createVnet ? split(existingAvdSubnetResourceId, '/')[2] : ''
var varExistingAvdVnetSubRgName = !createVnet ? split(existingAvdSubnetResourceId, '/')[4] : ''
var varExistingAvdVnetName = !createVnet ? split(existingAvdSubnetResourceId, '/')[8] : ''
var varExistingAvdVnetResourceId = !createVnet ? '/subscriptions/${varExistingAvdVnetSubId}/resourceGroups/${varExistingAvdVnetSubRgName}/providers/Microsoft.Network/virtualNetworks/${varExistingAvdVnetName}' : ''
//var varExistingPeVnetSubId = split(existingPeSubnetResourceId, '/')[2]
//var varExistingPeVnetSubRgName = split(existingPeSubnetResourceId, '/')[4]
//var varExistingAPeVnetName = split(existingPeSubnetResourceId, '/')[8]
//var varExistingPeVnetResourceId = '/subscriptions/${varExistingPeVnetSubId}/resourceGroups/${varExistingPeVnetSubRgName}/providers/Microsoft.Network/virtualNetworks/${varExistingAPeVnetName}'
// =========== //
// Deployments //
// =========== //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ param domainJoinUserPassword string
// Variable declaration //
// =========== //

var varscriptArgumentsWithPassword = '${scriptArguments} -DomainAdminUserPassword ${domainJoinUserPassword} -verbose'
var varscriptArgumentsWithPassword = '${scriptArguments} -DomainAdminUserPassword "${replace(domainJoinUserPassword, '"', '""')}" -verbose'


// =========== //
// Deployments //
Expand All @@ -46,3 +47,4 @@ resource dscStorageScript 'Microsoft.Compute/virtualMachines/extensions@2022-08-
}
}
}

12 changes: 6 additions & 6 deletions workload/bicep/modules/storageAzureFiles/deploy.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,17 @@ param storageAccountFqdn string
// Variable declaration //
// =========== //
var varAzureCloudName = environment().name
var varStoragePurposeLower = toLower(storagePurpose)
var varAvdFileShareLogsDiagnostic = [
'allLogs'
]
var varAvdFileShareMetricsDiagnostic = [
'Transaction'
]
var varWrklStoragePrivateEndpointName = 'pe-${storageAccountName}-file'
var varDirectoryServiceOptions = (identityServiceProvider == 'AADDS') ? 'AADDS': (identityServiceProvider == 'AAD') ? 'AADKERB': 'None'
var varSecurityPrincipalName = !empty(securityPrincipalName)? securityPrincipalName : 'none'
var varStorageToDomainScriptArgs = '-DscPath ${dscAgentPackageLocation} -StorageAccountName ${storageAccountName} -StorageAccountRG ${storageObjectsRgName} -StoragePurpose ${storagePurpose} -DomainName ${identityDomainName} -IdentityServiceProvider ${identityServiceProvider} -AzureCloudEnvironment ${varAzureCloudName} -SubscriptionId ${workloadSubsId} -DomainAdminUserName ${domainJoinUserName} -CustomOuPath ${storageCustomOuPath} -OUName ${ouStgPath} -ShareName ${fileShareName} -ClientId ${managedIdentityClientId} -SecurityPrincipalName ${varSecurityPrincipalName} -StorageAccountFqdn ${storageAccountFqdn} '
var varDirectoryServiceOptions = (identityServiceProvider == 'AADDS') ? 'AADDS' : (identityServiceProvider == 'AAD') ? 'AADKERB' : 'None'
var varSecurityPrincipalName = !empty(securityPrincipalName) ? securityPrincipalName : 'none'
var varStorageToDomainScriptArgs = '-DscPath ${dscAgentPackageLocation} -StorageAccountName ${storageAccountName} -StorageAccountRG ${storageObjectsRgName} -StoragePurpose ${storagePurpose} -DomainName ${identityDomainName} -IdentityServiceProvider ${identityServiceProvider} -AzureCloudEnvironment ${varAzureCloudName} -SubscriptionId ${workloadSubsId} -DomainAdminUserName ${domainJoinUserName} -CustomOuPath ${storageCustomOuPath} -OUName ${ouStgPath} -ShareName ${fileShareName} -ClientId ${managedIdentityClientId} -SecurityPrincipalName "${varSecurityPrincipalName}" -StorageAccountFqdn ${storageAccountFqdn} '

// =========== //
// Deployments //
// =========== //
Expand All @@ -136,7 +136,7 @@ module storageAndFile '../../../../carml/1.3.0/Microsoft.Storage/storageAccounts
activeDirectoryProperties: (identityServiceProvider == 'AAD') ? {
domainGuid: identityDomainGuid
domainName: identityDomainName
}: {}
} : {}
}
accessTier: 'Hot'
networkAcls: deployPrivateEndpoint ? {
Expand Down Expand Up @@ -172,7 +172,7 @@ module storageAndFile '../../../../carml/1.3.0/Microsoft.Storage/storageAccounts
privateDnsZoneGroup: {
privateDNSResourceIds: [
vnetPrivateDnsZoneFilesId
]
]
}
}
] : []
Expand Down
Binary file modified workload/scripts/DSCStorageScripts.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@

Write-Log "Unmounting drive"
# Remove-PSDrive -Name $DriveLetter -Force
net use ${DriveLetter} /delete
# HACK: Disabled because it fails
Fixed Show fixed Hide fixed
#net use ${DriveLetter} /delete
Write-Log "Drive unmounted"
}
Catch {
Expand Down
Loading