Containers/New-Container.ps1

function New-Container {
    Param(
        [Parameter(Mandatory=$false)]
        [string] $ContainerName,
        [Parameter(Mandatory=$false)]
        [string] $ImageName,
        [Parameter(Mandatory=$false)]
        [string] $LicenseFile,
        [Parameter(Mandatory=$false)]
        [pscredential] $Credential,
        [Parameter(Mandatory=$false)]
        [string] $Country = "",
        [switch] $alwaysPull,
        [switch] $SetupTestUsers,
        [switch] $SkipTestTool,
        [switch] $includeCSide
    )

    if ($null -eq $ContainerName -or $ContainerName -eq "") {
        $ContainerName = (Get-EnvironmentKeyValue -KeyName 'name')
    }

    if ($null -eq $Credential) {
        $NewCredential = New-CredentialFromEnvironmentJson
        if ($NewCredential -eq $false) {
            $Credential = [PSCredential]::new('admin', (ConvertTo-SecureString 'P@ssword1' -AsPlainText -Force))
            $Password = (ConvertTo-SecureString 'P@ssword1' -AsPlainText -Force)
        }
        else {
            $Credential = $NewCredential
            $Password = (ConvertTo-SecureString (Get-EnvironmentKeyValue -KeyName "password") -AsPlainText -Force)
        }
    } else {
        $Password = $Credential.Password
    }

    if ($null -eq $ImageName -or $ImageName -eq "") {
        $ImageName = (Get-ImageNameForRepo)
    }

    if ($Country -ne "") {
        $ImageName = (($ImageName -replace ".{2}$") + $Country)
    }
    Write-Host "Using Image $ImageName"

    New-NavContainer -containerName $ContainerName -accept_eula -accept_outdated -auth NavUserPassword `
    -Credential $Credential -imageName $ImageName -licenseFile $LicenseFile -updateHosts `
    -useBestContainerOS -includeAL -shortcuts None -includeTestToolkit:(!$SkipTestTool.IsPresent) -includeTestLibrariesOnly:(!$SkipTestTool.IsPresent) `
    -alwaysPull:$alwaysPull -doNotExportObjectsToText -includeCSide:$includeCSide

    if ($SetupTestUsers.IsPresent) {
        Setup-NavContainerTestUsers -containerName $ContainerName -Password $Password -credential $Credential
    }
}
Export-ModuleMember New-Container