SPF でギャラリー 項目をインポートする

重要

このバージョンの Service Provider Foundation (SPF) はサポート終了に達しました。 SPF 2022 にアップグレードすることをお勧めします。

ギャラリー項目は、標準および再利用可能な成果物として機能する VM ロールです。 これらの項目は、サービス プロバイダーをホストしてテナントにオファリングを提供するために使用できます。 Microsoft Azure Pack では、ギャラリー 項目をテナント サブスクリプション プランに追加できます。 仮想マシン ロールは、1 つのプロセスを使用するテナントがプロビジョニングできる、拡張可能な仮想マシンの層です。 仮想マシン ロールで作成できるワークロードの例として、単独の仮想マシン、Active Directory ドメイン コントローラー、SQL Server クラスター、インターネット インフォメーション サービス (IIS) Web ファームなどがあります。 ギャラリー リソースの詳細については、こちらを参照してください

System Center - Service Provider Foundation (SPF) では、ダウンロードしたリソース パッケージからギャラリー 項目を System Center - Virtual Machine Manager (VMM) にインポートできます。 ギャラリー項目は SPFDB データベースで追跡されます。 ギャラリー アイテムは、Microsoft Azure Pack 管理者が管理ポータルですぐに表示できるようになります。

SPF には、ギャラリーに次のコマンドレットが用意されています。

  • Get-SCSPFVMRoleGalleryItem

  • Get-SCSPFVMRoleGalleryItemIcon

  • Get-SCSPFVMRoleGalleryItemPackage

  • Import-SCSpfVMRoleGalleryItem

  • Remove-SCSPFVMRoleGalleryItem

  • Set-SCSPFVMRoleGalleryItem

SPF 管理 Web サービスまたはコマンドレットを使用して、アイテムのギャラリー パッケージ、アイテム、またはアイコンを取得できます。 ポータル開発者は、UI 要素と機能を作成して、ギャラリー 項目を選択する際の魅力的なエクスペリエンスをテナントに提供できます。

次の例は、PowerShell を使用してパッケージからギャラリー アイテムをインポートし、その内容を使用して削除する方法を示しています。

PS C:\> # The first command gets the path to the resource package and stores it in the $Path variable.   
PS C:\> # The second command gets a System.IO.FileStream object of the package.   
PS C:\> # The third command imports the package.  
PS C:\> $Path = "c:\packages\create.resdefpkg"  
PS C:\> $FStream = New-Object IO.FileStream $Path, Open  
PS C:\> Import-SCSPFVMRoleGalleryItem -Package $FStream  
PS C:\>  
PS C:\> # Get an item from the gallery by specifying its name and store it in the $galItem variable.  
PS C:\> $galItem = Get-ScSpfVmRoleGalleryItem -Name 570569955cbfb62b374358b34467020750f65c  
PS C:\>   
PS C:\> # Get the icon object by specifying the required parameters with the variable.   
PS C:\> # The IconFileName parameter is explicitly specified in case the variable has a null value for the icon file name.  
PS C:\> $galItemIcon = Get-SCSPFVMRoleGalleryItemIcon -Name $galItem.Name -Publisher $galItem.Publisher -Version $galItem.Version -IconFilename "contoso.ico"  
PS C:\>  
PS C:\> # Get the package of the gallery and stores it in the $galPkg variable. This cmdlets returns an System.IO.MemoryStream object.  
PS C:\> $galPkg = Get-SCSPFVMRoleGalleryItemPackage -Name 570569955cbfb62b374358b34467020750f65c -Publisher Microsoft -Version 1.0.0.0  
PS C:\>   
PS C:\> # One use of the memory stream of the package is to save it to a file on your computer.  
PS C:\> $fs = New-Object IO.Filestream "c:\@tmp\gal.bin", Create  
PS C:\> $binwriter = New-Object IO.BinaryWriter $fs  
PS C:\> $binwriter.Write($galPkg.ContentStream.ToArray())  
PS C:\> $fs.Close()  
PS C:\> $binwriter.Close()  
PS C:\>  
PS C:\> # Import the package that was just saved, using the PackageFilePath parameter.  
PS C:\> Import-ScSpfVmRoleGalleryItem -PackageFilePath "C:\@tmp\gal.bin"