Skip to content

Commit

Permalink
Merge pull request #1265 from PowerShell/dev
Browse files Browse the repository at this point in the history
Release of version 12.2.0.0 of SqlServerDsc
  • Loading branch information
kwirkykat authored Jan 10, 2019
2 parents 5cf11f7 + c78a95c commit 7fa69d2
Show file tree
Hide file tree
Showing 40 changed files with 346 additions and 334 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

## Unreleased

## 12.2.0.0

- Changes to SqlServerDsc
- During testing in AppVeyor the Build Worker is restarted in the install
step to make sure the are no residual changes left from a previous SQL
Server install on the Build Worker done by the AppVeyor Team
([issue #1260](https://github.com/PowerShell/SqlServerDsc/issues/1260)).
- Code cleanup: Change parameter names of Connect-SQL to align with resources.
- Updated README.md in the Examples folder.
- Added a link to the new xADObjectPermissionEntry examples in
ActiveDirectory, fixed a broken link and a typo.
[Adam Rush (@adamrushuk)](https://github.com/adamrushuk)
- Change to SqlServerLogin so it doesn't check properties for absent logins.
- Fix for ([issue #1096](https://github.com/PowerShell/SqlServerDsc/issues/1096))

## 12.1.0.0

- Changes to SqlServerDsc
Expand Down
4 changes: 2 additions & 2 deletions DSCResources/MSFT_SqlAG/MSFT_SqlAG.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function Get-TargetResource
)

# Connect to the instance
$serverObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$serverObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

# Define current version for check compatibility
$sqlMajorVersion = $serverObject.Version.Major
Expand Down Expand Up @@ -233,7 +233,7 @@ function Set-TargetResource
)

# Connect to the instance
$serverObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$serverObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

# Determine if HADR is enabled on the instance. If not, throw an error
if ( -not $serverObject.IsHadrEnabled )
Expand Down
8 changes: 4 additions & 4 deletions DSCResources/MSFT_SqlAGDatabase/MSFT_SqlAGDatabase.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function Get-TargetResource
}

# Connect to the instance
$serverObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$serverObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

# Is this node actively hosting the SQL instance?
$currentConfiguration.IsActiveNode = Test-ActiveNode -ServerObject $serverObject
Expand Down Expand Up @@ -194,7 +194,7 @@ function Set-TargetResource
Import-SQLPSModule

# Connect to the defined instance
$serverObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$serverObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

# Get the Availability Group
$availabilityGroup = $serverObject.AvailabilityGroups[$AvailabilityGroupName]
Expand Down Expand Up @@ -239,7 +239,7 @@ function Set-TargetResource

foreach ( $availabilityGroupReplica in $secondaryReplicas )
{
$currentAvailabilityGroupReplicaServerObject = Connect-SQL -SQLServer $availabilityGroupReplica.Name
$currentAvailabilityGroupReplicaServerObject = Connect-SQL -ServerName $availabilityGroupReplica.Name
$impersonatePermissionsStatus.Add(
$availabilityGroupReplica.Name,
( Test-ImpersonatePermissions -ServerObject $currentAvailabilityGroupReplicaServerObject )
Expand Down Expand Up @@ -679,7 +679,7 @@ function Test-TargetResource
}

# Connect to the defined instance
$serverObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$serverObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

# Get the Availability Group if it exists
if ( -not [System.String]::IsNullOrEmpty($currentConfiguration.AvailabilityGroupName) )
Expand Down
8 changes: 4 additions & 4 deletions DSCResources/MSFT_SqlAGListener/MSFT_SqlAGListener.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ function Set-TargetResource
{
New-VerboseMessage -Message "Create listener on $AvailabilityGroup"

$sqlServerObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sqlServerObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

$availabilityGroupObject = $sqlServerObject.AvailabilityGroups[$AvailabilityGroup]
if ($availabilityGroupObject)
Expand Down Expand Up @@ -220,7 +220,7 @@ function Set-TargetResource
{
New-VerboseMessage -Message "Remove listener from $AvailabilityGroup"

$sqlServerObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sqlServerObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

$availabilityGroupObject = $sqlServerObject.AvailabilityGroups[$AvailabilityGroup]
if ($availabilityGroupObject)
Expand Down Expand Up @@ -273,7 +273,7 @@ function Set-TargetResource
throw New-TerminatingError -ErrorType AvailabilityGroupListenerDHCPChangeError -FormatArgs @( $DHCP, $($availabilityGroupListenerState.DHCP) ) -ErrorCategory InvalidOperation
}

$sqlServerObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sqlServerObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

$availabilityGroupObject = $sqlServerObject.AvailabilityGroups[$AvailabilityGroup]
if ($availabilityGroupObject)
Expand Down Expand Up @@ -484,7 +484,7 @@ function Get-SQLAlwaysOnAvailabilityGroupListener

Write-Debug "Connecting to availability group $Name as $([System.Security.Principal.WindowsIdentity]::GetCurrent().Name)"

$sqlServerObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sqlServerObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

$availabilityGroupObject = $sqlServerObject.AvailabilityGroups[$AvailabilityGroup]
if ($availabilityGroupObject)
Expand Down
6 changes: 3 additions & 3 deletions DSCResources/MSFT_SqlAGReplica/MSFT_SqlAGReplica.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function Get-TargetResource
)

# Connect to the instance
$serverObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$serverObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

# Is this node actively hosting the SQL instance?
$isActiveNode = Test-ActiveNode -ServerObject $serverObject
Expand Down Expand Up @@ -238,7 +238,7 @@ function Set-TargetResource
Import-SQLPSModule

# Connect to the instance
$serverObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$serverObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

# Determine if HADR is enabled on the instance. If not, throw an error
if ( -not $serverObject.IsHadrEnabled )
Expand Down Expand Up @@ -385,7 +385,7 @@ function Set-TargetResource
else
{
# Connect to the instance that is supposed to house the primary replica
$primaryReplicaServerObject = Connect-SQL -SQLServer $PrimaryReplicaServerName -SQLInstanceName $PrimaryReplicaInstanceName
$primaryReplicaServerObject = Connect-SQL -ServerName $PrimaryReplicaServerName -InstanceName $PrimaryReplicaInstanceName

# Verify the Availability Group exists on the supplied primary replica
$primaryReplicaAvailabilityGroup = $primaryReplicaServerObject.AvailabilityGroups[$AvailabilityGroupName]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function Get-TargetResource
$InstanceName
)

$sqlServerObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sqlServerObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

$isAlwaysOnEnabled = [System.Boolean] $sqlServerObject.IsHadrEnabled
if ($isAlwaysOnEnabled -eq $true)
Expand Down
4 changes: 2 additions & 2 deletions DSCResources/MSFT_SqlDatabase/MSFT_SqlDatabase.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function Get-TargetResource
$Collation
)

$sqlServerObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sqlServerObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

if ($sqlServerObject)
{
Expand Down Expand Up @@ -142,7 +142,7 @@ function Set-TargetResource
$Collation
)

$sqlServerObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sqlServerObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

if ($sqlServerObject)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Function Get-TargetResource
Write-Verbose -Message ($script:localizedData.GetCurrentPath -f $Type, $InstanceName)

# Connect to the instance
$sqlServerObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sqlServerObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

# Is this node actively hosting the SQL instance?
$isActiveNode = Test-ActiveNode -ServerObject $sqlServerObject
Expand Down Expand Up @@ -153,7 +153,7 @@ Function Set-TargetResource
else
{
Write-Verbose -Message ($script:localizedData.SettingDefaultPath -f $Type)
$sqlServerObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sqlServerObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

# Check which default location is being updated
switch ($Type)
Expand Down
4 changes: 2 additions & 2 deletions DSCResources/MSFT_SqlDatabaseOwner/MSFT_SqlDatabaseOwner.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function Get-TargetResource
)

Write-Verbose -Message "Getting owner of database $Database"
$sqlServerObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sqlServerObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

if ($sqlServerObject)
{
Expand Down Expand Up @@ -123,7 +123,7 @@ function Set-TargetResource
)

Write-Verbose -Message "Setting owner $Name of database $Database"
$sqlServerObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sqlServerObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

if ($sqlServerObject)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function Get-TargetResource
$InstanceName
)

$sqlServerObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sqlServerObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

if ($sqlServerObject)
{
Expand Down Expand Up @@ -208,7 +208,7 @@ function Set-TargetResource
$InstanceName = 'MSSQLSERVER'
)

$sqlServerObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sqlServerObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

if ($sqlServerObject)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function Get-TargetResource
$Name
)

$sqlServerObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sqlServerObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

if ($sqlServerObject)
{
Expand Down Expand Up @@ -118,7 +118,7 @@ function Set-TargetResource
$Name
)

$sqlServerObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sqlServerObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

if ($sqlServerObject)
{
Expand Down
4 changes: 2 additions & 2 deletions DSCResources/MSFT_SqlDatabaseRole/MSFT_SqlDatabaseRole.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function Get-TargetResource

Write-Verbose -Message "Getting SQL Database role for $Name"

$sqlServerObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sqlServerObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

if ($sqlServerObject)
{
Expand Down Expand Up @@ -198,7 +198,7 @@ function Set-TargetResource

Write-Verbose -Message "Setting SQL Database role for $Name"

$sqlServerObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sqlServerObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

if ($sqlServerObject)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function Get-TargetResource
$RestartTimeout = 120
)

$sql = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sql = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

# Get the current value of the configuration option.
$option = $sql.Configuration.Properties | Where-Object { $_.DisplayName -eq $OptionName }
Expand Down Expand Up @@ -142,7 +142,7 @@ function Set-TargetResource
$RestartTimeout = 120
)

$sql = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sql = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

# Get the current value of the configuration option.
$option = $sql.Configuration.Properties | Where-Object { $_.DisplayName -eq $OptionName }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function Get-TargetResource
-f $ServerName, $InstanceName
)

$sqlServerObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sqlServerObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

if ($sqlServerObject)
{
Expand Down Expand Up @@ -292,7 +292,7 @@ function Set-TargetResource
-f $ServerName, $InstanceName
)

$sqlServerObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sqlServerObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

if ($sqlServerObject)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function Get-TargetResource
IpAddress = ''
}

$sqlServerObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sqlServerObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName
if ($sqlServerObject)
{
Write-Verbose -Message ('Connected to {0}\{1}' -f $ServerName, $InstanceName)
Expand Down Expand Up @@ -135,7 +135,7 @@ function Set-TargetResource

$getTargetResourceResult = Get-TargetResource -EndpointName $EndpointName -ServerName $ServerName -InstanceName $InstanceName

$sqlServerObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sqlServerObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName
if ($sqlServerObject)
{
if ($Ensure -eq 'Present' -and $getTargetResourceResult.Ensure -eq 'Absent')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function Get-TargetResource

try
{
$sqlServerObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sqlServerObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

$endpointObject = $sqlServerObject.Endpoints[$Name]
if ( $null -ne $endpointObject )
Expand Down Expand Up @@ -147,7 +147,7 @@ function Set-TargetResource
$getTargetResourceResult = Get-TargetResource @parameters
if ($getTargetResourceResult.Ensure -ne $Ensure)
{
$sqlServerObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sqlServerObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

$endpointObject = $sqlServerObject.Endpoints[$Name]
if ($null -ne $endpointObject)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function Get-TargetResource

try
{
$sqlServerObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sqlServerObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

$endpointObject = $sqlServerObject.Endpoints[$Name]
if ($null -ne $endpointObject)
Expand Down Expand Up @@ -114,7 +114,7 @@ function Set-TargetResource
{
New-VerboseMessage -Message ('Changing state of endpoint ''{0}''' -f $Name)

$sqlServerObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sqlServerObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

$endpointObject = $sqlServerObject.Endpoints[$Name]

Expand Down
8 changes: 4 additions & 4 deletions DSCResources/MSFT_SqlServerLogin/MSFT_SqlServerLogin.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function Get-TargetResource
$InstanceName
)

$serverObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$serverObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

Write-Verbose 'Getting SQL logins'
New-VerboseMessage -Message "Getting the login '$Name' from '$ServerName\$InstanceName'"
Expand Down Expand Up @@ -161,7 +161,7 @@ function Set-TargetResource
$Disabled
)

$serverObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$serverObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

switch ( $Ensure )
{
Expand Down Expand Up @@ -381,7 +381,7 @@ function Test-TargetResource
$testPassed = $false
}

if ( $Ensure -eq 'Present' )
if ( $Ensure -eq 'Present' -and $($loginInfo.Ensure) -eq 'Present' )
{
if ( $LoginType -ne $loginInfo.LoginType )
{
Expand Down Expand Up @@ -416,7 +416,7 @@ function Test-TargetResource

try
{
Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName -SetupCredential $userCredential -LoginType 'SqlLogin' | Out-Null
Connect-SQL -ServerName $ServerName -InstanceName $InstanceName -SetupCredential $userCredential -LoginType 'SqlLogin' | Out-Null
}
catch
{
Expand Down
4 changes: 2 additions & 2 deletions DSCResources/MSFT_SqlServerMaxDop/MSFT_SqlServerMaxDop.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function Get-TargetResource
$ServerName = $env:COMPUTERNAME
)

$sqlServerObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sqlServerObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

# Is this node actively hosting the SQL instance?
$isActiveNode = Test-ActiveNode -ServerObject $sqlServerObject
Expand Down Expand Up @@ -108,7 +108,7 @@ function Set-TargetResource
$ProcessOnlyOnActiveNode
)

$sqlServerObject = Connect-SQL -SQLServer $ServerName -SQLInstanceName $InstanceName
$sqlServerObject = Connect-SQL -ServerName $ServerName -InstanceName $InstanceName

if ($sqlServerObject)
{
Expand Down
Loading

0 comments on commit 7fa69d2

Please sign in to comment.