Assert‑SqlDscLogin - dsccommunity/SqlServerDsc GitHub Wiki
Assert that the specified SQL Server principal exists as a login.
Assert-SqlDscLogin [-ServerObject] <Server> [-Name] <String>
[<CommonParameters>]
This command asserts that the specified SQL Server principal exists as a login. If the principal does not exist as a login, a terminating error is thrown.
$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$serverObject | Assert-SqlDscLogin -Name 'MyLogin'
Asserts that the principal 'MyLogin' exists as a login.
$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
Assert-SqlDscLogin -ServerObject $serverObject -Name 'MyLogin'
Asserts that the principal 'MyLogin' exists as a login.
Specifies the name of the principal that needs to exist as a login.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies current server connection object.
Type: Server
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
This command throws a terminating error if the specified SQL Server principal does not exist as a SQL server login.