Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Cannot convert value when setting UseHTTPCRL set to true #1522

Open
aaearon opened this issue Apr 25, 2023 · 2 comments
Open

[Bug]: Cannot convert value when setting UseHTTPCRL set to true #1522

aaearon opened this issue Apr 25, 2023 · 2 comments
Assignees
Labels

Comments

@aaearon
Copy link

aaearon commented Apr 25, 2023

Description

When I have set UseHTTPCRL = $true for my CA role properties, I get the following error when doing Install-Lab:

SetValueInvocationException: Exception setting "Properties": "Cannot convert value "System.Collections.Hashtable" to type "AutomatedLab.SerializableDictionary`2[System.String,System.String]". Error: "The entry with the key
'UseHTTPCRL' could not be added due to the error: Unable to cast object of type 'System.Boolean' to type 'System.String'.""

Steps to reproduce the issue

  1. Define the properties in the role definition.
$CaRootRole = Get-LabMachineRoleDefinition -Role CaRoot @{
    CACommonName        = "$DomainName-DC01-CA"
    CAType              = 'EnterpriseRootCA'
    KeyLength           = '4096'
    UseHTTPCRL          = $true
    ValidityPeriod      = 'Years'
    ValidityPeriodUnits = '10'
}

$DC01Parameters = @{
    Name           = 'DC01'
    DomainName     = $DomainName
    Roles          = 'RootDC', $CaRootRole, 'Routing'
    NetworkAdapter = $DC01NetworkAdapters
}
Add-LabMachineDefinition @DC01Parameters
  1. Type Install-Lab.
  2. Receive error that looks something like the below:
21:39:24|00:00:00|00:00:00.000| Initialization
21:39:24|00:00:00|00:00:00.091| - Host operating system version: 'Microsoft Windows 11 Pro, 10.0.22621.0'
21:39:24|00:00:00|00:00:00.102| - Creating new lab definition with name 'TimSchindler'
21:39:24|00:00:00|00:00:00.121| - Location of lab definition files will be 'C:\ProgramData\AutomatedLab/Labs/TimSchindler'
21:39:25|00:00:00|00:00:00.770| - Location of LabSources folder is 'C:\LabSources'
21:39:25|00:00:00|00:00:00.000| - Auto-adding ISO files
21:39:25|00:00:01|00:00:00.248|   - Added 'C:\LabSources\ISOs\17763.3650.221105-1748.rs5_release_svc_refresh_SERVER_EVAL_x64FRE_en-us.iso'
21:39:25|00:00:01|00:00:00.282|   - Done
21:39:25|00:00:01|00:00:00.296| - Path for VMs specified as 'C:\AutomatedLab-VMs'
SetValueInvocationException: Exception setting "Properties": "Cannot convert value "System.Collections.Hashtable" to type "AutomatedLab.SerializableDictionary`2[System.String,System.String]". Error: "The entry with the key
'UseHTTPCRL' could not be added due to the error: Unable to cast object of type 'System.Boolean' to type 'System.String'.""
21:39:26|00:00:02|00:00:00.000| - Adding Hyper-V machine definition 'DC01'        (Roles: RootDC, CaRoot, Routing)
21:39:28|00:00:03|00:00:01.413|   - Done
21:39:28|00:00:03|00:00:00.000| - Adding Hyper-V machine definition 'SERVER01'
21:39:29|00:00:04|00:00:00.875|   - Done
21:39:29|00:00:04|00:00:00.000| - Adding Hyper-V machine definition 'VAULT01'
21:39:29|00:00:05|00:00:00.754|   - Done
21:39:30|00:00:06|00:00:00.000| - Adding Hyper-V machine definition 'COMP01'      (Roles: WebServer)
21:39:31|00:00:07|00:00:01.389|   - Done
21:39:32|00:00:08|00:00:00.000| - Adding Hyper-V machine definition 'PSM01'
21:39:33|00:00:08|00:00:00.882|   - Done

PowerShell Version

PS C:\Users\Tim>  $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.3.4
PSEdition                      Core
GitCommitId                    7.3.4
OS                             Microsoft Windows 10.0.22621
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

PS C:\Users\Tim>

AutomatedLab Version

PS C:\Users\Tim> Get-Module AutomatedLab* -List | Select Name,Version

Name                      Version
----                      -------
AutomatedLab              5.48.0
AutomatedLab              5.47.0
AutomatedLab.Common       2.3.17
AutomatedLab.Common       2.3.5
AutomatedLabDefinition    5.48.0
AutomatedLabDefinition    5.47.0
AutomatedLabNotifications 5.48.0
AutomatedLabNotifications 5.47.0
AutomatedLabTest          5.48.0
AutomatedLabTest          5.47.0
AutomatedLabUnattended    5.48.0
AutomatedLabUnattended    5.47.0
AutomatedLabWorker        5.48.0
AutomatedLabWorker        5.47.0

PS C:\Users\Tim>
@aaearon
Copy link
Author

aaearon commented Apr 26, 2023

Seems Yes and No are the valid options for UseHTTPCRL but this is not well documented. Where could this information best go and I could open a PR.

@raandree raandree self-assigned this Apr 26, 2023
@raandree raandree added the Bug label Apr 26, 2023
@raandree
Copy link
Member

Thank you for your report, @aaearon. The most convenient way for us would be a PR created by you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants