Skip to content

Commit

Permalink
Merge pull request #13 from Azure/Dev-RemoveMaxDeploymentCount
Browse files Browse the repository at this point in the history
Remove Max Deployment Count into User Managed Identity
  • Loading branch information
WillyMoselhy authored Jul 12, 2024
2 parents d860918 + 6a57a2d commit e648374
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 28 deletions.
7 changes: 0 additions & 7 deletions Build/Bicep/FunctionApps.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ param SHRDeploymentPrefix string = 'AVDSessionHostReplacer'
@description('Required: Yes | Number of session hosts to maintain in the host pool.')
param TargetSessionHostCount int

@description('Required: No | Maximum number of session hosts to deploy at the same time. | Default: 20')
param MaxSimultaneousDeployments int = 20

@description('Required: Yes | Prefix used for the name of the session hosts.')
param SessionHostNamePrefix string

Expand Down Expand Up @@ -180,10 +177,6 @@ var varFunctionAppSettings = [
name: '_TargetSessionHostCount'
value: TargetSessionHostCount
}
{
name: '_MaxSimultaneousDeployments'
value: MaxSimultaneousDeployments
}
{
name: '_Tag_IncludeInAutomation'
value: TagIncludeInAutomation
Expand Down
1 change: 0 additions & 1 deletion Build/BuildParams.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ $param = @{
FixSessionHostTags = $true
SHRDeploymentPrefix = "AVDSessionHostReplacer"
TargetSessionHostCount = 3
MaxSimultaneousDeployments = 2
SessionHostNamePrefix = "AVD-WE-D01" #Azure Virtual Desktop - West Europe - FullDesktop Host Pool 01
SessionHostTemplate = "URI or Template Spec Resource Id HERE"
ADOrganizationalUnitPath = "PATH HERE"
Expand Down
1 change: 0 additions & 1 deletion FunctionApp/FunctionParameters.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
_DrainGracePeriodHours = @{Required = $false ; Type = 'int ' ; Default = 24 ; Description = '' }
_FixSessionHostTags = @{Required = $false ; Type = 'bool ' ; Default = $true ; Description = '' }
_SHRDeploymentPrefix = @{Required = $false ; Type = 'string' ; Default = 'AVDSessionHostReplacer' ; Description = '' }
_MaxSimultaneousDeployments = @{Required = $false ; Type = 'int ' ; Default = 100 ; Description = 'Deprecated.This allows multiple deployments running simultaneously. Might change later to control maximum number of VMNames to deploy. Or control it using batches in template, or both!.' }
_AllowDownsizing = @{Required = $false ; Type = 'bool ' ; Default = $true ; Description = '' }
_SessionHostInstanceNumberPadding = @{Required = $false ; Type = 'int ' ; Default = 2 ; Description = '' }
_ReplaceSessionHostOnNewImageVersion = @{Required = $false ; Type = 'bool ' ; Default = $true ; Description = '' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ function Get-SHRHostPoolDecision {
[Parameter()]
[int] $TargetSessionHostCount = (Get-FunctionConfig _TargetSessionHostCount),

# Max number of session hosts to deploy at the same time
[Parameter()]
[int] $MaxSimultaneousDeployments = (Get-FunctionConfig _MaxSimultaneousDeployments),

# Latest image version
[Parameter()]
[PSCustomObject] $LatestImageVersion,
Expand Down Expand Up @@ -77,12 +73,6 @@ function Get-SHRHostPoolDecision {

if ($sessionHostsToDeployCount -gt 0) {
Write-PSFMessage -Level Host -Message "We need to deploy {0} session hosts" -StringValues $sessionHostsToDeployCount
Write-PSFMessage -Level Host -Message "Maximum number of simultaneous deployment allowed is {0}" -StringValues $MaxSimultaneousDeployments
$possibleDeploymentsCount = [int]$MaxSimultaneousDeployments - $runningDeployments.SessionHostNames.Count
if ($possibleDeploymentsCount -gt $sessionHostsToDeployCount) {
$possibleDeploymentsCount = $sessionHostsToDeployCount
}
Write-PSFMessage -Level Host -Message "We can start deployment of {0} session hosts" -StringValues $possibleDeploymentsCount
}
elseif($sessionHostsToDeployCount -lt 0 -and $AllowDownsizing){
Write-PSFMessage -Level Host -Message "We have too many session hosts. We need to decommission {0} session hosts" -StringValues $sessionHostsToDeployCount
Expand All @@ -105,7 +95,7 @@ function Get-SHRHostPoolDecision {
}

[PSCustomObject]@{
PossibleDeploymentsCount = $possibleDeploymentsCount
PossibleDeploymentsCount = $sessionHostsToDeployCount
AllowSessionHostDelete = $allowSessionHostDelete
SessionHostsPendingDelete = $sessionHostsToReplace
ExistingSessionHostVMNames = ([array]$SessionHosts.VMName + [array]$runningDeployments.SessionHostNames) | Select-Object -Unique
Expand Down
2 changes: 1 addition & 1 deletion FunctionApp/profile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Set-PSFConfig -FullName PSFramework.Message.style.NoColor -Value $true #This is

## Version Banner ## Updated by Build\Build-Zip-File.ps1

Write-PSFMessage -Level Host -Message "This is SessionHostReplacer version {0}" -StringValues 'v0.2.6-beta.18'
Write-PSFMessage -Level Host -Message "This is SessionHostReplacer version {0}" -StringValues 'v0.2.6-beta.20'


# Import Function Parameters
Expand Down
6 changes: 3 additions & 3 deletions deploy/arm/DeployAVDSessionHostReplacer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"_generator": {
"name": "bicep",
"version": "0.27.1.19265",
"templateHash": "13319527579829750478"
"templateHash": "1287073592818545409"
}
},
"parameters": {
Expand Down Expand Up @@ -488,7 +488,7 @@
"_generator": {
"name": "bicep",
"version": "0.27.1.19265",
"templateHash": "12007794242243274198"
"templateHash": "3737399076699030885"
}
},
"parameters": {
Expand Down Expand Up @@ -522,7 +522,7 @@
},
"FunctionAppZipUrl": {
"type": "string",
"defaultValue": "https://github.com/Azure/AVDSessionHostReplacer/releases/download/v0.2.6-beta.18/FunctionApp.zip",
"defaultValue": "https://github.com/Azure/AVDSessionHostReplacer/releases/download/v0.2.6-beta.20/FunctionApp.zip",
"metadata": {
"description": "Required: No | URL of the FunctionApp.zip file. This is the zip file containing the Function App code. | Default: The latest release of the Function App code."
}
Expand Down
2 changes: 1 addition & 1 deletion deploy/bicep/modules/deployFunctionApp.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ param LogAnalyticsWorkspaceId string = 'none'
param FunctionAppName string

@description('Required: No | URL of the FunctionApp.zip file. This is the zip file containing the Function App code. | Default: The latest release of the Function App code.')
param FunctionAppZipUrl string = 'https://github.com/Azure/AVDSessionHostReplacer/releases/download/v0.2.6-beta.18/FunctionApp.zip'
param FunctionAppZipUrl string = 'https://github.com/Azure/AVDSessionHostReplacer/releases/download/v0.2.6-beta.20/FunctionApp.zip'

@description('Required: No | App Service Plan Name | Default: Y1 for consumption based plan')
param AppPlanName string = 'Y1'
Expand Down
4 changes: 2 additions & 2 deletions deploy/portal-ui/portal-ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"options": {
"icon": "Info",
"text": "When using a User Assigned Managed Identity, make sure the identity has the needed permissions in Azure and Entra. Follow the link for more info.",
"uri": "https://github.com/Azure/AVDReplacementPlans/blob/v0.2.6-beta.18/docs/Permissions.md"
"uri": "https://github.com/Azure/AVDReplacementPlans/blob/v0.2.6-beta.20/docs/Permissions.md"
}
},
{
Expand Down Expand Up @@ -107,7 +107,7 @@
"type": "Microsoft.Common.TextBlock",
"visible": true,
"options": {
"text": "AVD session host replacer Portal UI Version: v0.2.6-beta.18",
"text": "AVD session host replacer Portal UI Version: v0.2.6-beta.20",
"link": {
"label": "GitHub Repository",
"uri": "https://github.com/Azure/AVDSessionHostReplacer"
Expand Down
2 changes: 1 addition & 1 deletion docs/CodeDeploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ $TemplateParameters = @{
$paramNewAzResourceGroupDeployment = @{
Name = 'AVDSessionHostReplacer'
ResourceGroupName = $ResourceGroupName
TemplateUri = 'https://raw.githubusercontent.com/Azure/AVDSessionHostReplacer/v0.2.6-beta.18/deploy/arm/DeployAVDSessionHostReplacer.json'
TemplateUri = 'https://raw.githubusercontent.com/Azure/AVDSessionHostReplacer/v0.2.6-beta.20/deploy/arm/DeployAVDSessionHostReplacer.json'
# If you cloned the repo and want to deploy using the bicep file use this instead of the above line
#TemplateFile = '.\deploy\bicep\DeployAVDSessionHostReplacer.bicep'
Expand Down

0 comments on commit e648374

Please sign in to comment.