Skip to content

Commit

Permalink
New-DbaAvailabilityGroup: Add support for contained availability grou…
Browse files Browse the repository at this point in the history
…ps (#9352)

Co-authored-by: Courtney Woolum <cwoolum@i.pointeblank.net>
Co-authored-by: Courtney Woolum <117998701+serenefiresiren@users.noreply.github.com>
Co-authored-by: Chrissy LeMaire <potatoqualitee@users.noreply.github.com>
Co-authored-by: Chrissy LeMaire <clemaire@gmail.com>
  • Loading branch information
5 people committed May 16, 2024
1 parent 0fd8aa0 commit d485883
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions public/New-DbaAvailabilityGroup.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function New-DbaAvailabilityGroup {
function New-DbaAvailabilityGroup {
<#
.SYNOPSIS
Automates the creation of availability groups.
Expand Down Expand Up @@ -382,13 +382,13 @@
}

if ($IsContained -and $server.VersionMajor -lt 16) {
Stop-Function -Level Warning -Message "Contained availability groups are only supported in SQL Server 2022 and above"
return
Stop-Function -Message "Contained availability groups are only supported in SQL Server 2022 and above" -Target $Primary
return
}

if ($ReuseSystemDatabases -and $IsContained -eq $false) {
Stop-Function -Level Warning -Message "Reuse system databases is only applicable in contained availability groups"
return
Stop-Function -Message "Reuse system databases is only applicable in contained availability groups" -Target $Primary
return
}

Write-ProgressHelper -StepNumber ($stepCounter++) -Message "Checking requirements"
Expand Down Expand Up @@ -698,4 +698,4 @@
# Get results
Get-DbaAvailabilityGroup -SqlInstance $Primary -SqlCredential $PrimarySqlCredential -AvailabilityGroup $Name
}
}
}
2 changes: 1 addition & 1 deletion tests/New-DbaAvailabilityGroup.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ Describe "$commandname Integration Tests" -Tag "IntegrationTests" {
$results.AvailabilityDatabases.Count | Should -Be 0 -Because "No database was named"
}
}
} #$script:instance2 for appveyor
} #$script:instance2 for appveyor

0 comments on commit d485883

Please sign in to comment.