[VMware Horizon][VDI] Unified Access GatewayをAzureへデプロイ

オンプレミス-クラウド-技術のお話し

PowerShellでやる模様

VMware Horizonで対外接続を担保するUnified Access Gateway、略してUAG。実はこれMicrosoft Azureにもデプロイメントできるらしいとのことで試してみることにしました。

デプロイメント自体、実は色々制約がありまして、結果として地雷を踏みまくる羽目になりましたのでそのあたりを備忘録としてまとめています。実際のブツは以下のファイルを使用しています。

  • uagdeploy-20.12.0.0-17307559.zip -> スクリプト本体
  • euc-unified-access-gateway-20.12.0.0-17307559_OVF10-vhd.zip -> VHDイメージ(可変型)

ダウンロードはMyVMwareから行うようにしてください。(ログオンアカウントが必要。ライセンスがない場合は評価版申請をすると良いと思います)

成功パターンはこんな感じ

先に成功した場合のパターンについて記載をしておきます。構築する際はこちらのほうが参考になります。

Azureリソースの作成

事前にAzure側のリソースを以下の通り作成します。

  • リソースグループ
  • 仮想ネットワーク(VNET、サブネット、NSG、Public IP)
  • ストレージアカウント(BLOBコンテナも作っておくと良いかも)

割と重要なのが、この事前作成リソースはすべて同一リソースグループ内に配置する必要があります。

ZIPパッケージを解凍・INIファイルを作成する

各ZIPパッケージを解凍します。そして、その中にあるINIファイルを参考にしながら設定を記載します。
私の環境だとこんな感じ。

[General]
name=UAG1
uagName=UAG1
deploymentOption=onenic

[Azure]
subscriptionID=********-****-****-****-************
resourceGroupName=BLUECORE-UAG
location=Japan West
storageAccountName=uagstor
imageURI=https://uagstor.blob.core.windows.net/uagdiskimg/euc-unified-access-gateway-20.12.0.0-17307559_OVF10-fixed.vhd
diskStorageContainer=uagdiskimg
vmSize=Standard_B2s
virtualNetworkName=vNET-UAG-BLUECORE

# eth0 settings
subnetName0=Labo-Network
publicIPAddressName0=UAGPublicIP
networkSecurityGroupName0=UAGInternetSG

VHDファイルをFixed Typeに変換する

さて、別途ダウンロードしているVHDファイルですが、アップロードを事前にストレージアカウントに対して行います。このとき、Fixed Typeにしておかないと後でエラーを吐きますので、PowerShellでConvert-VHDを実行するか、Starwind V2V Converterを使ってFixedに変換をします。

ダウンロード時点ではファイルサイズが5GBとなってますが、Fixedにすると20GBぐらいに膨れ上がりますので、このときのディスク空き容量については十分注意をしてください。

ページBLOBとしてStorageにアップロード

Storage Explorerなり、AzurePortalなりを使用して、VHDファイルをAzureのストレージアカウントへアップロードをしてください。このときFlet’s回線って速いですね。安定して300Mbpsぐらい出てくれましたー。

スクリプトの実行

で、PowerShellを管理者権限で起動し、以下順序でスクリプトを実行していきます。

> Install-Module -Name AzureRM -Force
> connect-AzurermAccount

これでスクリプト実行可能な状態になるので以下のようにして実行。

> cd <uagdeployフォルダをカレントディレクトリとするようパスを指定>
> .\uagdeployaz.ps1 .\<INIファイルの名前>.ini

すると、以下のような感じで入力を求められます。rootパスワードを求められますので、任意のパスワードを入力してください。

Unified Access Gateway (UAG) virtual appliance Microsoft Azure deployment script
Validating Azure subscription ..... OK
Enter a root password for UAG1: ********
Re-enter the root password: ********

続いて、GUIコンソールのAdminアカウントのパスワードを求められますので、任意のパスワードを入力してください。なお、記号が必須ですのでその点はご留意を。

An admin password must be specified if access to the UAG Admin UI and REST API is required
Enter password for  admin for the Admin UI access for UAG1. Hit return to skip this.: ********
Re-enter the password: ********

CEIPの加入どうする?と言う質問が出てきますので、ここは任意に。

Join the VMware Customer Experience Improvement Program?

This setting is supported in UAG versions 3.1 and newer.

VMware窶冱 Customer Experience Improvement Program (CEIP) provides VMware with information that enables VMware to
improve its products and services, to fix problems, and to advise you on how best to deploy and use our products.

As part of the CEIP, VMware collects technical information about your organization's use of VMware products and
services on a regular basis in association with your organization's VMware license key(s). This information does
not personally identify any individual.

Additional information regarding the data collected through CEIP and the purposes for which it is used by VMware
is set forth in the Trust & Assurance Center at http://www.vmware.com/trustvmware/ceip.html.

If you prefer not to participate in VMware's CEIP for UAG 3.1 and newer, you should enter no.

You may join or leave VMware's CEIP for this product at any time. In the UAG Admin UI in System Configuration,
there is a setting 'Join CEIP' which can be set to yes or no and has immediate effect.

To Join the VMware Customer Experience Improvement Program with Unified Access Gateway version 3.1 and newer,
either enter yes or just hit return as the default for this setting is yes.
Join CEIP for UAG1 ? (default is yes for UAG 3.1 and newer): yes

その後、自己証明書が作成され、VMのデプロイが開始されます。途中、NetworkInterfaceの削除処理がうまくいかなくて以下のようなエラーが出ますが、特にそこは問題なさそうです。

Deployment will use a self-signed SSL/TLS server certificate (SSLcert)
Deployment will use a self-signed SSL/TLS server certificate (SSLcertAdmin)
Remove-AzureRmNetworkInterface : 引数 'Force' を受け入れる位置指定パラメーターが見つかりません。
発生場所 C:\uagdeploy\uagdeployaz.ps1:226 文字:12
+     $out = Remove-AzureRmNetworkInterface -ResourceGroupName $resourc ...
+            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Remove-AzureRmNetworkInterface]、ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.Azure.Commands.Network.RemoveAzureNetworkInterface
   Command

Remove-AzureRmNetworkInterface : 引数 'Force' を受け入れる位置指定パラメーターが見つかりません。
発生場所 C:\uagdeploy\uagdeployaz.ps1:227 文字:12
+     $out = Remove-AzureRmNetworkInterface -ResourceGroupName $resourc ...
+            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Remove-AzureRmNetworkInterface]、ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.Azure.Commands.Network.RemoveAzureNetworkInterface
   Command

Remove-AzureRmNetworkInterface : 引数 'Force' を受け入れる位置指定パラメーターが見つかりません。
発生場所 C:\uagdeploy\uagdeployaz.ps1:228 文字:12
+     $out = Remove-AzureRmNetworkInterface -ResourceGroupName $resourc ...
+            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Remove-AzureRmNetworkInterface]、ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.Azure.Commands.Network.RemoveAzureNetworkInterface
   Command

引き続きデプロイ処理が継続し、無事成功したらいいかのような感じで正常終了となります。

Deploying UAG1 as Standard_B2s
Creating network interfaces ..
. OK
Creating disk image ... OK
Creating virtual appliance ... OK
Deployed UAG1 successfully to Azure resource group BLUECORE-UAG
ResourceGroupName Name      Location  MacAddress Primary EnableAcceleratedNetworking EnableIPForwarding ProvisioningSta
                                                                                                        te
----------------- ----      --------  ---------- ------- --------------------------- ------------------ ---------------
BLUECORE-UAG      UAG1-eth0 japanwest                    False                       False              Succeeded


PS C:\uagdeploy>

あとの設定周りに関しては、普通にオンプレミスへデプロイメントした場合と同様になります。

踏んだ地雷の数々

リージョン指定の誤り

リージョン指定をミスるとこんなエラーが出ます

Get-AzureRmResourceProvider : 13:50:53 - Provided location is not supported
発生場所 C:\uagdeploy\uagdeployaz.ps1:478 文字:13
+     $res =  Get-AzureRmResourceProvider -Location $settings.Azure.loc ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-AzureRmResourceProvider], Exception
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.GetAzureProviderCmdlet

Error: [Azure] location (jpwest) not found

リージョンは以下の形で指定する必要があります。

Specify a location from the following list:
East US
East US 2
West US
Central US
North Central US
South Central US
North Europe
West Europe
East Asia
Southeast Asia
Japan East
Japan West
Australia East
Australia Southeast
Australia Central
Brazil South
South India
Central India
West India
Canada Central
Canada East
West US 2
West Central US
UK South
UK West
Korea Central
Korea South
France Central
South Africa North
UAE North
Switzerland North
Germany West Central
Norway East

同一リソースグループのリソースしか見つけられない模様

どうやら、このデプロイスクリプトは同一リソースグループで構成していることしか想定してないようです。そのため、リソースグループの枠を超えたリソースを指定すると以下のようなエラーが出ます。

Creating network interfaces ..Error: [Azure] virtualNetworkName (vNET-BLUECORE-AZURE) not found

同一ストレージアカウントじゃないとうまく動かなさそう

ストレージアカウントも同様で、コピー元となるストレージアカウントと実際にUnManaged Diskを配置する先のストレージアカウントは同一で配置する必要がありそうです。

Error: Failed to create UAG1 VM (Source and destination storage accounts for disk 'UAG1-b28d2a13-bc60-4fec-9c02-d5e81667
ecd3-disk1.vhd' are different.
ErrorCode: ConflictingUserInput
ErrorMessage: Source and destination storage accounts for disk 'UAG1-b28d2a13-bc60-4fec-9c02-d5e81667ecd3-disk1.vhd' are different.
ErrorTarget:
StatusCode: 409
ReasonPhrase: Conflict
OperationID : de822f3b-2633-4a31-a01d-12473e19e834).
ResourceGroupName Name      Location  MacAddress Primary EnableAcceleratedNetworking EnableIPForwarding ProvisioningSta

処理前に事前のネットワークインタフェース削除が必要

ネットワークインタフェースは例えばスクリプトの実行が一度ころんだ場合など、過去に一度スクリプトが生成したリソースは削除しておく必要がありそうです。(削除処理がうまく動いてないっぽい?)

Creating network interfaces ..Error: [Azure] publicIPAddressName0 (UAGPublicIP) is already in use

その他もろもろ

  • VHDはFixedにしておかないとディスクアタッチ時にエラーになる
  • 元になるイメージには必ず拡張子を「.vhd」とする必要がある
  • Storage Explorerでファイルを転送したとき、StateがPendingでないことを確認すること。
    ファイルコピーが完了したあと、少しばかりファイル配置の最終処理が走ってることがある。

結局

私の環境では最終的にうまく配置することができず、結果的に失敗に終わってしまいました。
しかしながら、フィットする環境であれば、わりかし使いやすいものではないかなーとも思います。スクリプトを改修してManagedDiskベースにされている人もちらほら見かけましたので、そうしたスクリプトを見てみるのもまた一興ではないかなと思います。

Tags:

Comments are closed

PAGE TOP