Skip to content

Commit

Permalink
Merge pull request #2410 from dkirby-ms/main
Browse files Browse the repository at this point in the history
Update VI scenario with upstream changes to VI enabled by Arc extension deployment
  • Loading branch information
dkirby-ms authored Feb 9, 2024
2 parents 246fd48 + b135a4c commit b285a3a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ Connect-AksEdgeArc -JsonConfigFilePath $tempDir\aksedge-config.json
#####################################################################
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
Start-Sleep -Seconds 5
helm install ingress-nginx ingress-nginx/ingress-nginx

#####################################################################
Expand All @@ -149,19 +150,24 @@ Start-Sleep -Seconds 30
### Video Indexer setup
#####################################################################
$viApiVersion="2023-06-02-preview"
$extensionName="videoindexer"
#$version="1.0.28-preview" # switch to blank
$extensionName="video-indexer"
$version="1.0.41" # switch to blank
$namespace="video-indexer"
$releaseTrain="release" # switch to release
$storageClass="longhorn"

Write-Host "Create Cognitive Services on VI resource provider"
$createResourceUri = "https://management.azure.com/subscriptions/${env:subscriptionId}/resourceGroups/${env:resourceGroup}/providers/Microsoft.VideoIndexer/accounts/${env:videoIndexerAccountName}/CreateExtensionDependencies?api-version=${viApiVersion}"

$result = $(az rest --method post --uri $createResourceUri) | ConvertFrom-Json

Write-Host "Retrieving Cognitive Service Credentials..."

$getSecretsUri="https://management.azure.com/subscriptions/${env:subscriptionId}/resourceGroups/${env:resourceGroup}/providers/Microsoft.VideoIndexer/accounts/${env:videoIndexerAccountName}/ListExtensionDependenciesData?api-version=$viApiVersion"
$csResourcesData=$(az rest --method post --uri $getSecretsUri) | ConvertFrom-Json
while ($null -eq $csResourcesData) {
Write-Host "Retrieving Cognitive Service Credentials..."
$csResourcesData=$(az rest --method post --uri $getSecretsUri) | ConvertFrom-Json
Start-Sleep -Seconds 10
}
Write-Host

Write-Host "Getting VM public IP address..."
Expand All @@ -177,14 +183,16 @@ az k8s-extension create --name $extensionName `
--cluster-name $clusterName `
--resource-group $Env:resourceGroup `
--cluster-type connectedClusters `
--release-train $releaseTrain `
--version $version `
--auto-upgrade-minor-version false `
--config-protected-settings "speech.endpointUri=$($csResourcesData.speechCognitiveServicesEndpoint)" `
--config-protected-settings "speech.secret=$($csResourcesData.speechCognitiveServicesPrimaryKey)" `
--config-protected-settings "translate.endpointUri=$($csResourcesData.translatorCognitiveServicesEndpoint)" `
--config-protected-settings "translate.secret=$($csResourcesData.translatorCognitiveServicesPrimaryKey)" `
--config "videoIndexer.accountId=${Env:videoIndexerAccountId}" `
--config-protected-settings "ocr.endpointUri=$($csResourcesData.ocrCognitiveServicesEndpoint)" `
--config-protected-settings "ocr.secret=$($csResourcesData.ocrCognitiveServicesPrimaryKey)" `
--config "frontend.endpointUri=https://$ipAddress" `
--config "videoIndexer.accountId=${Env:videoIndexerAccountId}" `
--config "storage.storageClass=$storageClass" `
--config "storage.accessMode=ReadWriteMany"

Expand All @@ -195,7 +203,7 @@ New-NetFirewallRule -DisplayName "Allow Inbound Port 443" -Direction Inbound -Lo

Write-Host "Adding port forward for VI frontend..."
Start-Sleep -Seconds 20
$ing = kubectl get ing videoindexer-vi-arc -n $namespace -o json | ConvertFrom-Json
$ing = kubectl get ing video-indexer-vi-arc -n $namespace -o json | ConvertFrom-Json
$ingIp = $ing.status.loadBalancer.ingress.ip
netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=80 connectaddress=$ingIp connectport=80
netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=443 connectaddress=$ingIp connectport=443
Expand Down
8 changes: 2 additions & 6 deletions azure_jumpstart_hcibox/artifacts/PowerShell/Bootstrap.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -149,21 +149,17 @@ Register-ScheduledTask -TaskName "HCIBoxLogonScript" -Trigger $Trigger -User $ad
# Disable Edge 'First Run' Setup
Write-Host "Configuring Microsoft Edge."
$edgePolicyRegistryPath = 'HKLM:SOFTWARE\Policies\Microsoft\Edge'
$desktopSettingsRegistryPath = 'HKCU:SOFTWARE\Microsoft\Windows\Shell\Bags\1\Desktop'
$firstRunRegistryName = 'HideFirstRunExperience'
$firstRunRegistryValue = '0x00000001'
$savePasswordRegistryName = 'PasswordManagerEnabled'
$savePasswordRegistryValue = '0x00000000'
$autoArrangeRegistryName = 'FFlags'
$autoArrangeRegistryValue = '1075839525'

if (-NOT (Test-Path -Path $edgePolicyRegistryPath)) {
New-Item -Path $edgePolicyRegistryPath -Force | Out-Null
}

New-ItemProperty -Path $edgePolicyRegistryPath -Name $firstRunRegistryName -Value $firstRunRegistryValue -PropertyType DWORD -Force
New-ItemProperty -Path $edgePolicyRegistryPath -Name $savePasswordRegistryName -Value $savePasswordRegistryValue -PropertyType DWORD -Force
Set-ItemProperty -Path $desktopSettingsRegistryPath -Name $autoArrangeRegistryName -Value $autoArrangeRegistryValue -Force

# Change RDP Port
Write-Host "Updating RDP Port - RDP port number from configuration is $rdpPort"
Expand Down Expand Up @@ -207,5 +203,5 @@ Install-WindowsFeature -Name Hyper-V -IncludeAllSubFeature -IncludeManagementToo
# Clean up Bootstrap.log
Write-Header "Clean up Bootstrap.log."
Stop-Transcript
$logSuppress = Get-Content $($HCIBoxConfig.Paths.LogsDir)\Bootstrap.log | Where-Object { $_ -notmatch "Host Application: powershell.exe" }
$logSuppress | Set-Content $($HCIBoxConfig.Paths.LogsDir)\Bootstrap.log -Force
$logSuppress = Get-Content "$($HCIBoxConfig.Paths.LogsDir)\Bootstrap.log" | Where-Object { $_ -notmatch "Host Application: powershell.exe" }
$logSuppress | Set-Content "$($HCIBoxConfig.Paths.LogsDir)\Bootstrap.log" -Force
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,7 @@ function Set-HCIDeployPrereqs {
Get-NetAdapter StorageA | Disable-NetAdapter -Confirm:$false | Out-Null
Get-NetAdapter StorageB | Disable-NetAdapter -Confirm:$false | Out-Null

#Invoke the registration script. For this preview release, only eastus region is supported.
#Invoke the registration script. For this release, only eastus region is supported.
Invoke-AzStackHciArcInitialization -SubscriptionID $subId -ResourceGroup $resourceGroup -TenantID $tenantId -Region eastus -Cloud "AzureCloud" -ArmAccessToken $armtoken.Token -AccountID $clientId

Get-NetAdapter StorageA | Enable-NetAdapter -Confirm:$false | Out-Null
Expand Down

0 comments on commit b285a3a

Please sign in to comment.