RemoteApp Virtual Machine을 사용하여 애플리케이션 설치

Virtual Machine 서비스 카탈로그 템플릿을 통해 애플리케이션을 설치합니다.

애플리케이션 설치 스크립팅은 다음 시나리오를 지원합니다.

  • RemoteApp 앱 설치의 가장 일반적인 사용 사례는 Azure Virtual Destop에서 액세스할 수 있는 원격 애플리케이션을 배포하는 것입니다.
  • 사이버 보안 및 모니터링 에이전트와 같은 필수 구성 요소를 설치합니다.
  • 규정 준수 또는 애플리케이션 설정에 대한 구성 변경 내용을 스크립트합니다.

메모

이 샘플 배포는 데모용이며 네트워크, 시스템 또는 애플리케이션 관리에 대한 모든 모범 사례를 나타내지는 않습니다.

사전 요구 사항

RemoteApp 템플릿은 애플리케이션을 설치하고 Virtual Machine을 구성하는 프로세스를 자동화하는 스크립팅을 지원합니다. RemoteApp 앱 설치 사용을 시작하기 전에 다음이 있는지 확인해야 합니다.

메모

스토리지 계정이 다른 enclave에 있는 경우 스토리지 계정을 사용하여 enclave에 enclave 엔드포인트 를 만듭니다. 그런 다음, 해당 스토리지 계정 enclave와 애플리케이션을 설치하는 enclave 간에 enclave 연결을 만듭니다.

배포된 Azure 리소스

  • RemoteApp 예제 Virtual Machine
    • 디스크
    • Windows Virtual Machine
    • Windows Virtual Machine 확장

소프트웨어 배포됨

  • Windows
  • 선택한 애플리케이션

설치

스토리지 계정을 설정하여 Visual Studio Code 설치

  1. 스토리지 계정 내의 컨테이너에 앱 폴더를 추가합니다. 동일한 enclave 내에 설치하는 방법을 보여 주는 다이어그램 스토리지 계정이 포함된 enclave 외부에 설치하는 방법을 보여 주는 다이어그램
    • 파일 구조:
          - artifacts container
              - app folder
                  - app installer
                  - main script to install app
                  - (optional) additional scripts
                  - (optional) azcopy.exe
      
  2. 필요한 애플리케이션 설치 관리자를 다운로드합니다. 이 예제에서는 Vscode.exe 다운로드하고 스토리지 계정 앱 폴더에 설치 관리자를 업로드합니다.
  3. 스토리지 계정 앱 폴더에 main.ps1 추가한 Visual Studio Code 버전과 호환되는 애플리케이션 설치 관리자 스크립트를 업로드합니다.
        # Main powershell script that installs the application
    
        Start-Process 'C:/vscode/VSCodeSetup-x64-{version}.exe' -Argument "/VERYSILENT /MERGETASKS=!runcode"
    

설치 템플릿

  1. 워크로드 개요 페이지에서 .를 선택합니다 +Add an Azure Service.

워크로드 개요 페이지를 보여 주는 스크린샷.

  1. Service에 대해 Virtual Machine을 선택합니다.

서비스 카탈로그 목록에서 선택한 Virtual Machine을 보여 주는 스크린샷

  1. 리소스 그룹 선택 확인 및 선택 Next

  2. 기본 사항 탭:

    • 의 경우 Virtual Machine nameVirtual Machine의 이름을 입력합니다.
    • Admin usernameAdmin password의 경우, 가상 머신에 로그인할 때 사용하는 사용자 이름과 암호를 입력하세요.
  3. 앱 탭:

    • 의 경우 App folder URI컨테이너에 URI를 입력합니다. 컨테이너 내에서 아티팩트를 선택하고, 해당 URI를 복사하고, URI의 폴더 이름 뒤에 있는 모든 항목을 제거 합니다. 이 배포에서 사용할 애플리케이션 폴더 URI를 보여 주는 스크린샷

      원본 URI 고정된 URI
      <storage-account>https://.blob.core.windows.net/<container-name>/<folder-name>/<script>.ps1 <storage-account>https://.blob.core.windows.net/<container-name>/<folder-name>
    • Example:

      • storageaccountexample.blob.core.windows.net/artifacts/vscode
    • 입력의 경우 Main Script 애플리케이션을 설치하는 스크립트의 이름(예: main.ps1)입니다.

    Virtual Machine 배포 중 앱 탭을 보여 주는 스크린쇼입니다.

프라이빗 컨테이너:

  1. App folder in private container의 경우 Virtual Machine을 통해 reader 역할이 스토리지 계정에 액세스할 수 있도록 true을 선택합니다.

  2. Storage container resource id의 경우 다음 세 부분을 가져옵니다: <storage-account-resource-id> + '/blobServices/default/containers/' + <container-name>.

    • Storage container resource id를 가져오려면 스토리지 계정에서 "개요"를 선택하고, 맨 오른쪽에서 "JSON View"를 선택한 다음 스토리지 계정 리소스 ID를 복사합니다.

    이 배포에 사용할 계정 리소스 ID의 스크린샷

    • 컨테이너 이름의 경우 아티팩트가 있는 프라이빗 컨테이너의 이름을 복사합니다.
    • 스토리지 컨테이너 리소스 ID 예제: subscriptions/000000a0-a0a0-000a-00a0-0000aaa0a000/resourceGroups/providers/Microsoft.Storage/storageAccounts/storage-account-example/blobServices/default/containers/container-name
  3. 매개 변수 AzCopy File URI 가 표시되면 컨테이너의 azcopy.exe URI를 추가합니다.

    • 파일을 선택하고 해당 URL을 복사합니다.

    azcopy.exe 파일이 있는 스토리지 컨테이너 조직 구조를 보여 주는 스크린샷

    azcopy.exe 파일의 URI를 보여 주는 스크린샷

프라이빗 컨테이너 매개 변수 예제:

완료된 앱 탭 매개 변수를 보여 주는 스크린샷

  1. Review and Create을 선택하고, 유효성 검사를 통과하면 Create을 선택합니다.
  2. 리소스가 배포되면 Application Virtual Machine에 연결하여 애플리케이션 Virtual Machine에 앱이 설치되어 있는지 확인합니다. Application Virtual Machine에 연결

WinGet 설치

폴더 구조:

- artifacts container
    - WinGet app folder ('winget')
        - WinGet installer ('Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle')
        - Windows UI Library ('Microsoft.UI.Xaml.2.8.x64.appx')
        - main script to schedule install ('main.ps1')
        - script to install and schedule reboot('install_winget.ps1')
        - ('restart.ps1')

winget을 RemoteApp에 설치한 다음 winget을 사용하여 다른 애플리케이션을 설치하고 관리하는 데 필요한 아티팩트 스크린샷

  1. 설치 관리자를 다운로드하고 스토리지 컨테이너의 winget 폴더에 업로드
  2. 스크립트 만들기 및 업로드
    1. main.ps1
      # This script creates and runs a scheduled task to install the appx package and msix bundle with elevated privileges
      
      $installScriptPath = "C:\winget\install_winget.ps1"
      
      # Create a scheduled task action to run the installation script with elevated permissions
      $taskAction = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument "-ExecutionPolicy Bypass -File $installScriptPath"
      
      # Set the task to start 30 seconds from now
      $taskTrigger = New-ScheduledTaskTrigger -Once -At (Get-Date).AddSeconds(30)
      $taskPrincipal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -LogonType ServiceAccount -RunLevel Highest
      
      # Register the scheduled task
      Register-ScheduledTask -TaskName "InstallWinget" -Action $taskAction -Trigger $taskTrigger -Principal $taskPrincipal
      
    2. install_winget.ps1
      Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force
      
      Start-Process -FilePath "DISM.exe" -ArgumentList "/Online /Add-ProvisionedAppxPackage /PackagePath:C:\winget\Microsoft.UI.Xaml.2.8.x64.appx /SkipLicense" -NoNewWindow -Wait
      Start-Process -FilePath "DISM.exe" -ArgumentList "/Online /Add-ProvisionedAppxPackage /PackagePath:C:\winget\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle /SkipLicense" -NoNewWindow -Wait
      
      $wingetDir = 'C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.23.1791.0_x64__8wekyb3d8bbwe'
      $currentPath = [System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine)
      [System.Environment]::SetEnvironmentVariable("Path", "$currentPath;$wingetDir", [System.EnvironmentVariableTarget]::Machine)
      
      # Schedule the reboot script
      $rebootScriptPath = "C:\winget\reboot.ps1"
      $taskAction = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument "-ExecutionPolicy Bypass -File $rebootScriptPath"
      
      # Set the task to start 30 seconds from now
      $taskTrigger = New-ScheduledTaskTrigger -Once -At ((Get-Date).AddSeconds(30))
      $taskPrincipal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -LogonType ServiceAccount -RunLevel Highest
      
      # Register the scheduled task
      Register-ScheduledTask -TaskName "Reboot" -Action $taskAction -Trigger $taskTrigger -Principal $taskPrincipal
      
    3. restart.ps1
      Restart-Computer -Force
      
  3. 템플릿 배포 진행