Arulselvan balakrishnan1709158059 Posted March 12, 2019 Share Posted March 12, 2019 how to add azure host connection through powershell citrix 7.18 Link to comment
0 Victor Cataluna Posted March 12, 2019 Share Posted March 12, 2019 Hi Sadhana10, here is a sample script that created service principal for subscription and hosting connection object and resources. This script assumes you have installed Azure PowerShell provider along with Virtual Apps and Desktops Remote PowerShell SDK on the same machine. Hope this helps. # Sample script to create Hosting Connection and Hypervisor for Microsoft Azure Add-PSSnapin Citrix* # Function creates subscription scope service principal [https://support.citrix.com/article/CTX219243] function createServicePrincipal($subId, $appName, [SecureString]$appPassword) { $application = New-AzADApplication -DisplayName $appName -HomePage "https://localhost/$appName" -IdentifierUris "https://$appName" -Password $appPassword New-AzADServicePrincipal -ApplicationId $application.ApplicationId # Wait for the service principal to become available Start-Sleep -s 60 New-AzRoleAssignment -RoleDefinitionName Contributor -ServicePrincipalName $application.ApplicationId -scope "/subscriptions/$subId" return $application.ApplicationId } # Variables $azureAppName = "CVAD-SubscriptionScopeSP" [SecureString]$azureAppPassword = "<secure password for service principal>" | ConvertTo-SecureString -AsPlainText -Force $azureSubscription = "<azure subscription id>" $azureTenant = "<azure subscription tenant id>" $azureRegion = "<azure region name>" $azureResourceGroup = "<azure resource group name>" $azureVNet = "<azure virtual network name>" $azureSubnet = "<azure subnet name>" $connectionName = "<citrix hosting connecttion name>" $hostingName = "<citrix hosting connecttion hypervisor name>" $configZone = Get-ConfigZone -Name "<citrix zone name>" $username = createServicePrincipal -subId $azureSubscription -appName $azureAppName -appPassword $azureAppPassword Set-HypAdminConnection $connObject = New-Item -ConnectionType "Custom" -CustomProperties "<CustomProperties xmlns=`"http://schemas.citrix.com/2014/xd/machinecreation`" xmlns:xsi=`"http://www.w3.org/2001/XMLSchema-instance`"><Property xsi:type=`"StringProperty`" Name=`"SubscriptionId`" Value=`"$azureSubscription`" /><Property xsi:type=`"StringProperty`" Name=`"ManagementEndpoint`" Value=`"https://management.azure.com/`" /><Property xsi:type=`"StringProperty`" Name=`"AuthenticationAuthority`" Value=`"https://login.microsoftonline.com/`" /><Property xsi:type=`"StringProperty`" Name=`"StorageSuffix`" Value=`"core.windows.net`" /><Property xsi:type=`"StringProperty`" Name=`"azureTenant`" Value=`"$azureTenant`" /></CustomProperties>" -HypervisorAddress @("https://management.azure.com/") -Path @("XDHyp:\Connections\$connectionName") -Persist -PluginId "AzureRmFactory" -Scope @() -SecurePassword $azureAppPassword -UserName $userName -ZoneUid $configZone.Uid New-BrokerHypervisorConnection -HypHypervisorConnectionUid $connObject.HypervisorConnectionUid New-Item -HypervisorConnectionName $connObject.HypervisorConnectionName -NetworkPath @("XDHyp:\Connections\$connectionName\$azureRegion.region\virtualprivatecloud.folder\$azureResourceGroup.resourcegroup\$azureVNet.virtualprivatecloud\$azureSubnet.network") -Path @("XDHyp:\HostingUnits\$hostingName") -PersonalvDiskStoragePath @() -RootPath "XDHyp:\Connections\$connectionName\$azureRegion.region" -StoragePath @() Link to comment
0 Arulselvan balakrishnan1709158059 Posted March 14, 2019 Author Share Posted March 14, 2019 Thanks Victor. it helped a lot Link to comment
0 Raju Sudha Posted October 22, 2020 Share Posted October 22, 2020 Thank you so much Victor. Its really a great fix Link to comment
Question
Arulselvan balakrishnan1709158059
how to add azure host connection through powershell citrix 7.18
Link to comment
3 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now