Skip to content

Commit 85ea1ed

Browse files
authored
SqlServerDsc: Moving examples to GitHub repository Wiki (#2052)
1 parent 1bf09ec commit 85ea1ed

File tree

4 files changed

+186
-209
lines changed

4 files changed

+186
-209
lines changed

CHANGELOG.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
### Changed
99

10+
- SqlServerDsc
11+
- The examples that was located in the README in the examples folder has
12+
now been moved to the WikiSource folder. The examples are published to
13+
the repository Wiki. The README has been updated to link to the new
14+
location ([issue #2051](https://github.com/dsccommunity/SqlServerDsc/issues/2051)).
1015
- SqlSetup
1116
- Fixed issue with AddNode where cluster IP information was not being passed to
12-
setup.exe. ([issue #1171](https://github.com/dsccommunity/SqlServerDsc/issues/1171))
17+
setup.exe ([issue #1171](https://github.com/dsccommunity/SqlServerDsc/issues/1171)).
1318

1419
### Fixed
1520

@@ -35,16 +40,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3540
- SqlScript
3641
- BREAKING CHANGE: The parameter `Id` is now required to allow
3742
reuse of a script with different variables. Set this to a unique value.
38-
The information entered is never used to actually run the script.
43+
The information entered is never used to actually run the script
3944
([issue #596](https://github.com/dsccommunity/SqlServerDsc/issues/596)).
4045
- Fix unit test to fully check Set-TargetResource using timeout.
4146
- SqlScriptQuery
4247
- BREAKING CHANGE: The parameter `Id` is now required to allow
4348
reuse of a script with different variables. Set this to a unique value.
44-
The information entered is never used to actually run the script.
49+
The information entered is never used to actually run the script
4550
([issue #596](https://github.com/dsccommunity/SqlServerDsc/issues/596)).
4651
- Fix unit test to fully check Set-TargetResource using timeout.
47-
4852
- SqlServerDsc
4953
- Replaced inline task `Package_Wiki_Content` with the one now available
5054
in the module _DscResource.DocGenerator_.

source/Examples/README.md

+3-205
Original file line numberDiff line numberDiff line change
@@ -3,208 +3,6 @@
33
This will help to understand how to setup certain scenarios with SqlServerDsc
44
resource module.
55

6-
## Resource examples
7-
8-
These are the links to the examples for each individual resource.
9-
10-
- [SqlAG](Resources/SqlAG)
11-
- [SqlAGDatabase](Resources/SqlAGDatabase)
12-
- [SqlAgentAlert](Resources/SqlAgentAlert)
13-
- [SqlAgentOperator](Resources/SqlAgentOperator)
14-
- [SqlAGListener](Resources/SqlAGListener)
15-
- [SqlAGReplica](Resources/SqlAGReplica)
16-
- [SqlAlias](Resources/SqlAlias)
17-
- [SqlAlwaysOnService](Resources/SqlAlwaysOnService)
18-
- [SqlAudit](Resources/SqlAudit)
19-
- [SqlDatabase](Resources/SqlDatabase)
20-
- [SqlDatabaseDefaultLocation](Resources/SqlDatabaseDefaultLocation)
21-
- [SqlDatabasePermission](Resources/SqlDatabasePermission)
22-
- [SqlDatabaseRole](Resources/SqlDatabaseRole)
23-
- [SqlDatabaseUser](Resources/SqlDatabaseUser)
24-
- [SqlRS](Resources/SqlRS)
25-
- [SqlRSSetup](Resources/SqlRSSetup)
26-
- [SqlScript](Resources/SqlScript)
27-
- [SqlScriptQuery](Resources/SqlScriptQuery)
28-
- [SqlConfiguration](Resources/SqlConfiguration)
29-
- [SqlDatabaseMail](Resources/SqlDatabaseMail)
30-
- [SqlEndpoint](Resources/SqlEndpoint)
31-
- [SqlEndpointPermission](Resources/SqlEndpointPermission)
32-
- [SqlLogin](Resources/SqlLogin)
33-
- [SqlMaxDop](Resources/SqlMaxDop)
34-
- [SqlMemory](Resources/SqlMemory)
35-
- [SqlPermission](Resources/SqlPermission)
36-
- [SqlReplication](Resources/SqlReplication)
37-
- [SqlRole](Resources/SqlRole)
38-
- [SqlSecureConnection](Resources/SqlSecureConnection)
39-
- [SqlServiceAccount](Resources/SqlServiceAccount)
40-
- [SqlSetup](Resources/SqlSetup)
41-
- [SqlWaitForAG](Resources/SqlWaitForAG)
42-
- [SqlWindowsFirewall](Resources/SqlWindowsFirewall)
43-
44-
## Setting up a SQL Server Failover Cluster
45-
46-
This will reference examples that show how to setup high availability SQL Server
47-
using a Failover Cluster.
48-
It assumes that a working domain exists with at least one Domain Controller, and
49-
and both servers that should contain the SQL Server nodes are domain joined.
50-
51-
### Prepare Active Directory
52-
53-
If the user who creates the failover cluster has the **Create Computer Objects**
54-
permission to the organizational unit (OU) where the servers that will form the
55-
cluster reside, then there is no need to prestage the Cluster Named Object (CNO)
56-
computer object.
57-
However, if the user creating the failover cluster does not have this permission,
58-
prestaging the Cluster Named Object (CNO) computer object becomes necessary.
59-
It is also possible to prestage the Virtual Computer Objects (VCO).
60-
61-
Read more about it here
62-
[Prestage Cluster Computer Objects in Active Directory Domain Services](https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/dn466519(v=ws.11)).
63-
64-
#### Prestage the Cluster Named Object (CNO) computer object
65-
66-
There could be one Active Directory Organizational Unit (OU) where the Cluster
67-
Named Object (CNO) computer object resides. This is so that permission can be given
68-
to the CNO to allow the creation of a Virtual Computer Object (VCO).
69-
Preferably the CNO should be added to an Active Directory security group and that
70-
group has the permission to create computer objects inside the OU. This way, more
71-
than one CNO computer object can use the same OU.
72-
73-
Please note that the prestaged CNO computer object must be disabled before creating
74-
the failover cluster, and that the security group must be given the permission
75-
**Create Computer Objects** on the OU where the CNO computer object was created.
76-
Also the user creating the failover cluster must have the permission **Full Control**
77-
on the CNO computer object.
78-
79-
The [xADObjectPermissionEntry examples](https://github.com/PowerShell/xActiveDirectory/tree/dev/Examples/Resources/xADObjectPermissionEntry)
80-
at the resource module [xActiveDirectory](https://github.com/PowerShell/xActiveDirectory)
81-
can be used to set the correct permissions.
82-
83-
```powershell
84-
<#
85-
Creates the Organizational Unit for the CNO.
86-
#>
87-
xADOrganizationalUnit 'ClusterComputerObjects'
88-
{
89-
Ensure = 'Present'
90-
Name = 'Cluster Computer Objects'
91-
Path = 'DC=companylab,DC=se'
92-
ProtectedFromAccidentalDeletion = $true
93-
Description = 'The Cluster Computer Objects (CNO) ' `
94-
+ 'and Virtual Computer Objects (VCO).'
95-
96-
# A user with enough permission to create the OU.
97-
Credential = $DomainAdministratorCredential
98-
}
99-
100-
<#
101-
Creates the Cluster Named Object (CNO) computer object.
102-
#>
103-
xADComputer 'TESTCLU01'
104-
{
105-
ComputerName = 'TESTCLU01'
106-
DnsHostName = 'TESTCLU01.companylab.se'
107-
Path = 'OU=Cluster Computer Objects,DC=companylab,DC=se'
108-
Description = 'Cluster Network Object (CNO) ' `
109-
+ 'for Failover Cluster TESTCLU01.'
110-
111-
# A user with enough permission to create the computer object.
112-
DomainAdministratorCredential = $DomainAdministratorCredential
113-
}
114-
115-
<#
116-
Creates the security group and adds the Cluster Named Object (CNO)
117-
as a member to the group.
118-
#>
119-
xADGroup 'ActiveDirectoryCreateClusterVirtualComputerObjects'
120-
{
121-
Ensure = 'Present'
122-
GroupName = 'Active Directory Create Cluster Virtual Computer Objects'
123-
GroupScope = 'Global'
124-
Category = 'Security'
125-
Description = 'Group that will give permission to a Cluster Name Object ' `
126-
+ '(CNO) to create one or more Virtual Computer Object (VCO).'
127-
MembersToInclude = 'TESTCLU01$'
128-
129-
# A user with enough permission to create the security group.
130-
Credential = $DomainAdministratorCredential
131-
}
132-
```
133-
134-
#### Create Failover Cluster
135-
136-
The example [Create a Failover Cluster with two nodes](https://github.com/PowerShell/xFailOverCluster/blob/dev/Examples/Resources/xCluster/3-CreateFailoverClusterWithTwoNodes.ps1)
137-
at the resource module [xFailOverCluster](https://github.com/PowerShell/xFailOverCluster)
138-
can be used to create the failover cluster. It is an example, and it should be
139-
changed to match your configuration. Also, please see other resource examples in
140-
[xFailOverCluster](https://github.com/PowerShell/xFailOverCluster) to see if
141-
they could improve you configuration, for example the resource xClusterQuorum.
142-
143-
> [!IMPORTANT]
144-
> Make sure any user accounts you use in the configuration exist in
145-
> Active Directory and that they have the correct permission.
146-
147-
#### Install SQL Server Failover Cluster Instance
148-
149-
The example shows how to
150-
[install the first SQL Server Failover Cluster node for a named instance](https://github.com/PowerShell/SqlServerDsc/blob/dev/Examples/Resources/SqlSetup/4-InstallNamedInstanceInFailoverClusterFirstNode.ps1).
151-
And this example shows how to
152-
[install the second SQL Server Failover Cluster node for a named instance](https://github.com/PowerShell/SqlServerDsc/blob/dev/Examples/Resources/SqlSetup/5-InstallNamedInstanceInFailoverClusterSecondNode.ps1).
153-
154-
> [!IMPORTANT]
155-
> Make sure any user accounts you use in the configuration exist in
156-
> Active Directory and that they have the correct permission.
157-
158-
## Setting up a SQL Server AlwaysOn Availability Groups
159-
160-
This will reference examples that show how to setup high availability using
161-
AlwaysOn Availability Group.
162-
It assumes that a working domain exists with at least one Domain Controller,
163-
and both servers that should contain the SQL Server nodes are domain joined.
164-
165-
### Prepare Active Directory
166-
167-
Please see [Prepare Active Directory](#prepare-active-directory). The same applies
168-
to the failover cluster needed for SQL Server AlwaysOn Availability Groups.
169-
170-
#### Create Failover Cluster
171-
172-
Please see [Create Failover Cluster](#create-failover-cluster). The same applies
173-
to the failover cluster needed for SQL Server AlwaysOn Availability Groups.
174-
175-
#### Install SQL Server on replicas
176-
177-
> [!NOTE]
178-
> Make sure any user accounts you use in the configuration exist in
179-
> Active Directory and that they have the correct permission.
180-
181-
##### Install SQL Server on the primary node
182-
183-
The example shows how to
184-
[install a SQL Server named instance on a single server](https://github.com/PowerShell/SqlServerDsc/blob/dev/Examples/Resources/SqlSetup/2-InstallNamedInstanceSingleServer.ps1)
185-
which will be used as the primary replica node in the SQL Server AlwaysOn
186-
Availability Group.
187-
188-
##### Install SQL Server on the secondary node
189-
190-
The example shows how to
191-
[install a SQL Server named instance on a single server](https://github.com/PowerShell/SqlServerDsc/blob/dev/Examples/Resources/SqlSetup/2-InstallNamedInstanceSingleServer.ps1)
192-
which will be used as the secondary replica node in the SQL Server AlwaysOn
193-
Availability Group.
194-
195-
#### Enable AlwaysOn on both primary and secondary replica
196-
197-
AlwaysOn must be enabled on both the primary and secondary replica, and the example
198-
[Enable AlwaysOn](https://github.com/PowerShell/SqlServerDsc/blob/dev/Examples/Resources/SqlAlwaysOnService/1-EnableAlwaysOn.ps1)
199-
shows how to enable it (which requires that a working Failover Cluster is
200-
present on the node).
201-
202-
#### Configure SQL Server AlwaysOn Availability Group
203-
204-
Once AlwaysOn is enabled we can create the Availability Group. The example [Create Availability Group](https://github.com/PowerShell/SqlServerDsc/blob/dev/Examples/Resources/SqlAGReplica/1-CreateAvailabilityGroupReplica.ps1)
205-
shows how to create the Availability Group on the primary replica and join the
206-
Availability Group on the secondary replica.
207-
208-
> [!IMPORTANT]
209-
> Make sure any user accounts you use in the configuration exist in
210-
> Active Directory and that they have the correct permission.
6+
See the [GitHub repository Wiki](https://github.com/dsccommunity/SqlServerDsc/wiki)
7+
for examples of how to use the resources. Also see the section Usage for
8+
more examples for certain areas.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
Category: Usage
3+
---
4+
5+
# Setting up a SQL Server AlwaysOn Availability Groups
6+
7+
This will reference examples that show how to setup high availability using
8+
AlwaysOn Availability Group.
9+
It assumes that a working domain exists with at least one Domain Controller,
10+
and both servers that should contain the SQL Server nodes are domain joined.
11+
12+
## Prepare Active Directory
13+
14+
Please see [Prepare Active Directory](#prepare-active-directory). The same applies
15+
to the failover cluster needed for SQL Server AlwaysOn Availability Groups.
16+
17+
## Create Failover Cluster
18+
19+
Please see [Create Failover Cluster](#create-failover-cluster). The same applies
20+
to the failover cluster needed for SQL Server AlwaysOn Availability Groups.
21+
22+
## Install SQL Server on replicas
23+
24+
> [!NOTE]
25+
> Make sure any user accounts you use in the configuration exist in
26+
> Active Directory and that they have the correct permission.
27+
28+
### Install SQL Server on the primary node
29+
30+
The example shows how to
31+
[install a SQL Server named instance on a single server](https://github.com/PowerShell/SqlServerDsc/blob/dev/Examples/Resources/SqlSetup/2-InstallNamedInstanceSingleServer.ps1)
32+
which will be used as the primary replica node in the SQL Server AlwaysOn
33+
Availability Group.
34+
35+
### Install SQL Server on the secondary node
36+
37+
The example shows how to
38+
[install a SQL Server named instance on a single server](https://github.com/PowerShell/SqlServerDsc/blob/dev/Examples/Resources/SqlSetup/2-InstallNamedInstanceSingleServer.ps1)
39+
which will be used as the secondary replica node in the SQL Server AlwaysOn
40+
Availability Group.
41+
42+
## Enable AlwaysOn on both primary and secondary replica
43+
44+
AlwaysOn must be enabled on both the primary and secondary replica, and the example
45+
[Enable AlwaysOn](https://github.com/PowerShell/SqlServerDsc/blob/dev/Examples/Resources/SqlAlwaysOnService/1-EnableAlwaysOn.ps1)
46+
shows how to enable it (which requires that a working Failover Cluster is
47+
present on the node).
48+
49+
## Configure SQL Server AlwaysOn Availability Group
50+
51+
Once AlwaysOn is enabled we can create the Availability Group. The example
52+
[Create Availability Group](https://github.com/PowerShell/SqlServerDsc/blob/dev/Examples/Resources/SqlAGReplica/1-CreateAvailabilityGroupReplica.ps1)
53+
shows how to create the Availability Group on the primary replica and join the
54+
Availability Group on the secondary replica.
55+
56+
> [!IMPORTANT]
57+
> Make sure any user accounts you use in the configuration exist in
58+
> Active Directory and that they have the correct permission.

0 commit comments

Comments
 (0)