New-AzGalleryInVMAccessControlProfileVersion
在 VMAccessControlProfile 中建立資源庫的新版本。
語法
Default (預設值)
New-AzGalleryInVMAccessControlProfileVersion
-ResourceGroupName <String>
-GalleryName <String>
-GalleryInVMAccessControlProfileName <String>
-GalleryInVmAccessControlProfileVersion <PSGalleryInVMAccessControlProfileVersion>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
範例
範例 1
New-AzGalleryInVMAccessControlProfileVersion -ResourceGroupName "myResourceGroup" -GalleryName "myGallery" -GalleryInVMAccessControlProfileName "myProfile" -GalleryInVmAccessControlProfileVersion $inVMAccessControlProfileVersion
在 VMAccessControlProfile 中建立資源庫版本。
範例 2
$rgname = "myResourceGroup"
$location = "West US 2"
$galleryName = "myGallery"
$inVMAccessProfileName = "myProfile"
$inVMAccessProfileVersionName = "myProfileVersion"
# Create a gallery
New-AzGallery -ResourceGroupName $rgname -GalleryName $galleryName -Location $location -Description "My custom image gallery"
# Create a gallery inVMAccessControlProfile
New-AzGalleryInVMAccessControlProfile -ResourceGroupName $rgname -GalleryName $galleryName -GalleryInVMAccessControlProfileName $InVMAccessControlProfileName -Location $location -OsType "Windows" -ApplicableHostEndPoint "WireServer"
# Create a gallery inVMAccessControlProfile version config
$inVMAccessControlProfileVersion = New-AzGalleryInVMAccessControlProfileVersionConfig -Name $inVMAccessControlProfileVersionName -Location $location -Mode "Audit" -DefaultAccess "Deny" -TargetLocation @("Wesut US2", "West US") -ExcludeFromLatest
# Add rules to PSGalleryInVMAccessControlProfileVersion
Add-AzGalleryInVMAccessControlProfileVersionRulesPrivilege -GalleryInVmAccessControlProfileVersion $inVMAccessControlProfileVersion -PrivilegeName "GoalState" -Path "/machine" -QueryParameter @{ comp = "goalstate" }
Add-AzGalleryInVMAccessControlProfileVersionRulesRole -GalleryInVmAccessControlProfileVersion $inVMAccessControlProfileVersion -RoleName "Provisioning" -Privilege @("GoalState")
Add-AzGalleryInVMAccessControlProfileVersionRulesIdentity -GalleryInVmAccessControlProfileVersion $inVMAccessControlProfileVersion -IdentityName "WinPA" -UserName "SYSTEM" -GroupName "Administrators" -ExePath "C:\Windows\System32\cscript.exe" -ProcessName "cscript"
Add-AzGalleryInVMAccessControlProfileVersionRulesRoleAssignment -GalleryInVmAccessControlProfileVersion $inVMAccessControlProfileVersion -Role "Provisioning" -Identity @("WinPA")
# Create the gallery inVMAccessControlProfile version resource in Azure
New-AzGalleryInVMAccessControlProfileVersion -ResourceGroupName $rgname -GalleryName $galleryName -GalleryInVMAccessControlProfileName $inVMAccessProfileName -GalleryInVmAccessControlProfileVersion $inVMAccessControlProfileVersion
先建立資源庫和 InVM 存取控制設定檔,然後使用規則建置本機設定檔版本設定,最後將它部署至 Azure,以建立完整的 InVM 存取控制設定檔設定。
參數
-Confirm
在執行 Cmdlet 之前,提示您進行確認。
參數屬性
參數集
(All)
| Position: | Named |
| 必要: | False |
| 來自管線的值: | False |
| 來自管線按屬性名稱的值: | False |
| 來自剩餘引數的值: | False |
-DefaultProfile
用於與 Azure 通訊的認證、帳戶、租用戶和訂用帳戶。
參數屬性
參數集
(All)
| Position: | Named |
| 必要: | False |
| 來自管線的值: | False |
| 來自管線按屬性名稱的值: | False |
| 來自剩餘引數的值: | False |
-GalleryInVMAccessControlProfileName
VM 存取控制設定檔中的資源庫名稱。
參數屬性
| 類型: | String
|
| 預設值: | None |
| 支援萬用字元: | False |
| 不要顯示: | False |
參數集
(All)
| Position: | Named |
| 必要: | True |
| 來自管線的值: | False |
| 來自管線按屬性名稱的值: | True |
| 來自剩餘引數的值: | False |
-GalleryInVmAccessControlProfileVersion
PSGalleryInVmAccessControlProfileVersion 從 New-AzGalleryInVMAccessControlProfileVersionConfig 建立的物件。
參數屬性
參數集
(All)
| Position: | Named |
| 必要: | True |
| 來自管線的值: | False |
| 來自管線按屬性名稱的值: | True |
| 來自剩餘引數的值: | False |
-GalleryName
圖庫的名稱。
參數屬性
| 類型: | String
|
| 預設值: | None |
| 支援萬用字元: | False |
| 不要顯示: | False |
參數集
(All)
| Position: | Named |
| 必要: | True |
| 來自管線的值: | False |
| 來自管線按屬性名稱的值: | True |
| 來自剩餘引數的值: | False |
-ResourceGroupName
資源群組的名稱。
參數屬性
| 類型: | String
|
| 預設值: | None |
| 支援萬用字元: | False |
| 不要顯示: | False |
參數集
(All)
| Position: | Named |
| 必要: | True |
| 來自管線的值: | False |
| 來自管線按屬性名稱的值: | True |
| 來自剩餘引數的值: | False |
-WhatIf
顯示 Cmdlet 執行時會發生什麼事。 指令未執行。
參數屬性
參數集
(All)
| Position: | Named |
| 必要: | False |
| 來自管線的值: | False |
| 來自管線按屬性名稱的值: | False |
| 來自剩餘引數的值: | False |
CommonParameters
此 Cmdlet 支援常見參數:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 如需詳細資訊,請參閱 about_CommonParameters。
輸出