简体   繁体   中英

Regarding AWS Tools for PowerShell - Creating Workspaces

I hope life is going well. I'm in the process of trying to create AWS Workspaces for user accounts via PowerShell. I'm already familiar with the process of executing this via AWS CLI and have great success using the JSON template. However I'm running into a wall when it comes to executing this in PowerShell. My overall objective is to make the process of creating WorkSpaces a little more programmable. The current line:

New-WKSWorkspace -Workspace @{"BundleId" = "xxxxxx"; "UserName" = "xxxxxx"; "DirectoryId" = "xxxxxxx";} 

This line executes just fine and creates the workspace based on the parameters entered. My issue is that I need to have the "VolumeEncryptionKey" set in the initial phase when creating the workspace. However when reading through the AWS Tools documentation for PowerShell and running this command:

Get-Command Get-WKSWorkspace -ShowCommandInfo

I'm not able to find an argument for "VolumeEncryptionKey" which is causing a problem. I thought I could set the value via:

(Get-WKSWorkspace -WorkspaceId xxxxxxxxxx).VolumeEncryptionKey

But that doesn't really help and there appears to be no "Set-WKSWorkspace" command either. Has anyone had any experience building Workspaces using the AWS Tools for PowerShell before? Please let me know.

So I tried executing that particularly command before:

New-WKSWorkspace -Workspace @{ "VolumeEncryptionKey" = "xxxxxx"; "BundleId" = "xxxxxx"; "UserName" = "xxxxxx"; "DirectoryId" = "xxxxxxx";}

But it generates an error:

在此处输入图像描述

在此处输入图像描述

Here's the JSON Skeleton that I use that works really well:

{
"Workspaces": [
  {
    "DirectoryId": "xxxxxxxxxxx",
    "UserName": "xxxxxxxx",
    "BundleId": "xxxxxxxx",
    "VolumeEncryptionKey": "xxxxxxxxxxxx",
    "UserVolumeEncryptionEnabled": true,
    "RootVolumeEncryptionEnabled": true,
    "WorkspaceProperties": {
      "RunningMode": "ALWAYS_ON",
      "RootVolumeSizeGib": 175,
      "UserVolumeSizeGib": 100,
      "ComputeTypeName": "PERFORMANCE"
    },
    "Tags": [
      {
        "Key": "xxxxxxx",
        "Value": "xxxxxxxxxxx"
      }
    ]
  }
]

}

The game plan was to try and run this via AWS Tools for PowerShell.

From a cursory reading of the documentation I would conclude you need to include it in the -Workspace argument:

New-WKSWorkspace -Workspace @{"VolumeEncryptionKey" = "<VEK goes here>"; "BundleId" = "xxxxxx"; "UserName" = "xxxxxx"; "DirectoryId" = "xxxxxxx"; } 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM