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

Support for complex AD domain join passwords #522

Merged
merged 5 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
23 changes: 12 additions & 11 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 @@ -538,10 +537,10 @@ 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 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 @@ -960,7 +961,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 +988,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 +1168,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 +1211,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
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ param domainJoinUserPassword string
// Variable declaration //
// =========== //

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

// =========== //
// Deployments //
Expand Down
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

Check notice

Code scanning / devskim

A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note

Suspicious comment
#net use ${DriveLetter} /delete
Write-Log "Drive unmounted"
}
Catch {
Expand Down
Loading