Skip to content

Commit

Permalink
Add example for multi-instance
Browse files Browse the repository at this point in the history
  • Loading branch information
apichaya-s committed Aug 25, 2018
1 parent 3aabc26 commit cea1154
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
([issue #1199](https://github.com/PowerShell/SqlServerDsc/issues/1199)).
[Nick Reilingh (@NReilingh)](https://github.com/NReilingh)
- Changes to SqlDatabaseOwner
- Support multi-instances which is the instance cannot be omitted
- BREAKING CHANGE: Support multi-instances which is the instance cannot be omitted
([issue #1197](https://github.com/PowerShell/SqlServerDsc/issues/1197)).

## 11.4.0.0
Expand Down
6 changes: 3 additions & 3 deletions DSCResources/MSFT_SqlDatabaseOwner/MSFT_SqlDatabaseOwner.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function Get-TargetResource
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.String]
$InstanceName = 'MSSQLSERVER'
$InstanceName
)

Write-Verbose -Message "Getting owner of database $Database"
Expand Down Expand Up @@ -119,7 +119,7 @@ function Set-TargetResource
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.String]
$InstanceName = 'MSSQLSERVER'
$InstanceName
)

Write-Verbose -Message "Setting owner $Name of database $Database"
Expand Down Expand Up @@ -194,7 +194,7 @@ function Test-TargetResource
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.String]
$InstanceName = 'MSSQLSERVER'
$InstanceName
)

Write-Verbose -Message "Testing owner $Name of database $Database"
Expand Down
23 changes: 21 additions & 2 deletions Examples/Resources/SqlDatabaseOwner/1-SetDatabaseOwner.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Configuration Example

node localhost
{
SqlServerLogin Add_SqlServerLogin_SQLAdmin
SqlServerLogin Add_SqlServerLogin_SQLAdmin_DSC
{
Ensure = 'Present'
Name = 'CONTOSO\SQLAdmin'
Expand All @@ -26,13 +26,32 @@ Configuration Example
PsDscRunAsCredential = $SqlAdministratorCredential
}

SqlDatabaseOwner Set_SqlDatabaseOwner_SQLAdmin
SqlServerLogin Add_SqlServerLogin_SQLAdmin_DSC2
{
Ensure = 'Present'
Name = 'CONTOSO\SQLAdmin'
LoginType = 'WindowsUser'
ServerName = 'sqltest.company.local'
InstanceName = 'DSC2'
PsDscRunAsCredential = $SqlAdministratorCredential
}

SqlDatabaseOwner Set_SqlDatabaseOwner_SQLAdmin_DSC
{
Name = 'CONTOSO\SQLAdmin'
Database = 'AdventureWorks'
ServerName = 'sqltest.company.local'
InstanceName = 'DSC'
PsDscRunAsCredential = $SqlAdministratorCredential
}

SqlDatabaseOwner Set_SqlDatabaseOwner_SQLAdmin_DSC2
{
Name = 'CONTOSO\SQLAdmin'
Database = 'AdventureWorks'
ServerName = 'sqltest.company.local'
InstanceName = 'DSC2'
PsDscRunAsCredential = $SqlAdministratorCredential
}
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ For more information about database owner, please read the article
* **`[String]` Name** _(Required)_: The name of the login that will become a owner
of the desired sql database.
* **`[String]` ServerName** _(Write)_: The host name of the SQL Server to be configured.
* **`[String]` InstanceName** _(Write)_: The name of the SQL instance to be configured.
* **`[String]` InstanceName** _(Key)_: The name of the SQL instance to be configured.

#### Examples

Expand Down

0 comments on commit cea1154

Please sign in to comment.