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

ESRI Enterprise Add-On: SFI & ZTA updates #1135

Merged
merged 9 commits into from
Nov 28, 2024
2 changes: 1 addition & 1 deletion docs/deployment-guides/command-line-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The following prerequisites are required on the target Azure subscription(s):

### Decide on a Resource Prefix

Resource Groups and resource names are derived from the required parameter `resourcePrefix`. Pick a unqiue resource prefix that is 3-6 alphanumeric characters in length without whitespaces.
Resource Groups and resource names are derived from the required parameter `resourcePrefix`. Pick a unqiue resource prefix that is 1-6 alphanumeric characters in length without whitespaces.

### One Subscription or Multiple

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Param(
[string]$HostPoolResourceId,
[string]$ResourceGroupName,
[string]$ResourceManagerUri,
[string]$ScalingPlanName,
[string]$SubscriptionId,
[string]$UserAssignedIdentityClientId
)

$ErrorActionPreference = 'Stop'
$WarningPreference = 'SilentlyContinue'

# Fix the resource manager URI since only AzureCloud contains a trailing slash
$ResourceManagerUriFixed = if($ResourceManagerUri[-1] -eq '/'){$ResourceManagerUri} else {$ResourceManagerUri + '/'}

# Get an access token for Azure resources
$AzureManagementAccessToken = (Invoke-RestMethod `
-Headers @{Metadata="true"} `
-Uri $('http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=' + $ResourceManagerUriFixed + '&client_id=' + $UserAssignedIdentityClientId)).access_token

# Set header for Azure Management API
$AzureManagementHeader = @{
'Content-Type'='application/json'
'Authorization'='Bearer ' + $AzureManagementAccessToken
}

# Check if the scaling plan exists: https://learn.microsoft.com/rest/api/desktopvirtualization/scaling-plans/list-by-resource-group
$ScalingPlanExists = (Invoke-RestMethod `
-Headers $AzureManagementHeader `
-Method 'GET' `
-Uri $($ResourceManagerUriFixed + 'subscriptions/' + $SubscriptionId + '/resourceGroups/' + $ResourceGroupName + '/providers/Microsoft.DesktopVirtualization/scalingPlans?api-version=2023-09-05')).value | Where-Object {$_.name -eq $ScalingPlanName}

# Disable autoscale for the host pool: https://learn.microsoft.com/rest/api/desktopvirtualization/scaling-plans/update
if ($ScalingPlanExists)
{
Invoke-RestMethod `
-Body (@{properties = @{hostPoolReferences = @(@{hostPoolArmPath = $HostPoolResourceId; scalingPlanEnabled = $false})}} | ConvertTo-Json -Depth 3) `
-Headers $AzureManagementHeader `
-Method 'PATCH' `
-Uri $($ResourceManagerUriFixed + 'subscriptions/' + $SubscriptionId + '/resourceGroups/' + $ResourceGroupName + '/providers/Microsoft.DesktopVirtualization/scalingPlans/' + $ScalingPlanName + '?api-version=2023-09-05') | Out-Null
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ param (
[string]$ImageOffer,
[string]$ImagePublisher,
[string]$ImageSku,
[string]$ResourceManagerUri
[string]$ResourceManagerUri,
[string]$SubscriptionId,
[string]$UserAssignedIdentityClientId
)

# Fix the resource manager URI since only AzureCloud contains a trailing slash
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading