AutomatedLab.Recipe Invoke-LabRecipe - hardcoded roles/ISOs definitions #1413
-
DescriptionHi, thank you for the awesome tool. I have tried to deploy SQL 2019 using Recipe, i.e. this example New-LabRecipe
-Name RecSQLServer2019
-Description 'Deploy SQLServer2019'
-VmPrefix SQL -DeployRole SQL -PassThru
-DefaultOperatingSystem 'Windows Server 2022 Standard (Desktop Experience)' However, the hardcoded values in the functions force me to move SQL 2019 ISO to the AutomatedLab/AutomatedLab.Recipe/Public/Invoke-LabRecipe.ps1 Lines 68 to 76 in 7a2d330 Is it possible to reuse Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@MikeyBronowski recipes are only for easier use, the preferred way is and will remain creating a lab definition to fully customize your environment. Take a look at Get-LabSnippet *domain*
Get-LabSnippet -Type SampleScript
Get-LabSnippet -Type CustomRole
# Create new snippet
$sql2019Snippet = {
Add-LabIsoImageDefinition -Name SQLServer2019 -IsoPath "$labSources/ISOs/sql2019.iso"
# Variable $DomainName is inherited from the required domain snippet. Do
# your own handling if you don't need this.
Add-LabMachineDefinition -Name SQL001 -Role SQLServer2019 -DomainName $DomainName
}
New-LabSnippet -Name Sql2019 -Description 'Basic snippet to add SQL 2019 to a lab' -Tag Sql -Type Snippet -ScriptBlock $sql2019Snippet -DependsOn LabDefinition, Domain -Force
# Create a lab from snippets
Invoke-LabSnippet -Name Sql2019 # Dependencies are resolved automatically, parameters are queried
# Create lab from snippets with parameters
Invoke-LabSnippet -Name Sql2019 -LabParameter @{
DomainName = 'contoso.com'
AdminCredential = [pscredential]::new('usr', ('pw' | ConvertTo-SecureString -AsPlain -Force))
Name = 'SqlLab'
DefaultVirtualizationEngine = 'HyperV'
MachineNetwork = '10.0.0.0/24'
} |
Beta Was this translation helpful? Give feedback.
@MikeyBronowski recipes are only for easier use, the preferred way is and will remain creating a lab definition to fully customize your environment.
Take a look at
Get-Command -Noun LabSnippet
for a customizable solution, if you want modularization: