Cmdlets to provide and manage SQL servers for tests.
Returns connection parameter for a SQL server in a new Docker container.
New-SqlTestDockerInstance [-DockerContainerName <String>] [-ServerAdminPassword <String>] [-AcceptEula]
[-Timeout <Int32>] [-Port <Int32>] [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm]
[<CommonParameters>]
Creates a Docker container with SQL Server and returns an object with connection metadata. Requires Docker, the psdocker module, and acceptance of the Microsoft SQL Server EULA.
$container = New-SqlTestDockerInstance -DockerContainerName 'sql-test' -Port 58955 -AcceptEula
Creates a SQL Server container named sql-test. Container details and mapped port depend on the local Docker environment.
Captured output (password omitted):
Name : sql-test Hostname : localhost DataSource : localhost Port : 58955 UserId : sa ConnectTimeout : 30 IsDocker : True TrustServerCertificate : True
PS> $container | Remove-SqlTestDockerInstance Removes the container created by this example.
Specifies the name of the new Docker container.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: ( ( New-Guid ).ToString().Substring(0, 8) )
Accept pipeline input: False
Accept wildcard characters: False
Specifies the password for the sa user.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: Pa$$w0rd!
Accept pipeline input: False
Accept wildcard characters: False
Confirms your acceptance of the [End-User Licensing Agreement](https://go.microsoft.com/fwlink/?linkid=857698).
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Specifies the seconds to wait for the SQL service.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: 30
Accept pipeline input: False
Accept wildcard characters: False
Specifies the port to map the sql server to.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: 1433
Accept pipeline input: False
Accept wildcard characters: False
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Prompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
https://abbgrade.github.io/PsSqlTestServer/docs/New-SqlTestDockerInstance.html