|
| 1 | +# PureStorageDbaTools |
| 2 | + |
| 3 | +The module contains powershell functions to refresh SQL Server databases, create snapshots of SQL Server databases and obfuscate sensitive data via |
| 4 | +SQL Server's dynamic data masking functionality. This functionality is currently provided by three functions: |
| 5 | + |
| 6 | +- Invoke-PfaDbRefresh |
| 7 | +- New-PfaDbSnapshot |
| 8 | +- Enable-DataMasks |
| 9 | + |
| 10 | +## Getting Started |
| 11 | + |
| 12 | +### Prerequisites |
| 13 | + |
| 14 | +This module is built on top of both dbatools and the PureStoragePowerShellSDK modules, as such it has the following prerequisites: |
| 15 | + |
| 16 | +- Windows PowerShell 3.0 or higher . |
| 17 | +- .NET Framework 4.5 . |
| 18 | +- Purity Operating Environments that support REST API 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6 and 1.7 . |
| 19 | +- 64-bit Windows Server or Client operating system . |
| 20 | +- This release requires an operating system that supports the TLS 1.1/1.2 protocols such as Windows 7 or higher and Windows Server 2008 R2 or higher . |
| 21 | +- SQL Server 2008 SMO or SSMS . |
| 22 | +- SQL Server 2016 or above in order for the data masking functionality to work . |
| 23 | + |
| 24 | +### Installation |
| 25 | + |
| 26 | +This module should always be downloaded and installed from the Powershell gallery as follows: |
| 27 | + |
| 28 | +PS> Save-Module -Name PureStorageDbaTools -Path <path> |
| 29 | + |
| 30 | +PS> Install-Module -Name PureStorageDbaTools |
| 31 | + |
| 32 | +### Usage |
| 33 | + |
| 34 | +Once installed full documentation including example can be obtained on the three functions that the module contains via the Get-Help |
| 35 | +cmdlet: |
| 36 | + |
| 37 | +1. Get-Help Invoke-PfaDbRefresh |
| 38 | + |
| 39 | +will provide basic information on how the function can be used |
| 40 | + |
| 41 | +2. Get-Help Invoke-PfaDbRefresh -Detailed |
| 42 | + |
| 43 | +will provide detailed information on how the function can be used including examples. Both the Invoke-PfaDbRefresh and New-PfaDbSnapshot |
| 44 | +functions use powershell credentials objects in order to comply with the security best practices and polices mandated by the Powershell gallery . |
| 45 | + |
| 46 | +If we then call the Invoke-PfaDbRefresh, in this example the tpch-no-compression database on Z-STN-WIN2016-A\DEVOPSPRD is being used to refresh Z-STN-WIN2016-A\DEVOPSDEV1 and Z-STN-WIN2016-A\DEVOPSDEV2, the -ApplyDataMasks switch will cause the data mask to be applied: |
| 47 | + |
| 48 | +### Examples |
| 49 | + |
| 50 | +$Pwd = Get-Content ‘C:\Temp\Secure-Credentials.txt’ | ConvertTo-SecureString |
| 51 | +$Creds = New-Object System.Management.Automation.PSCredential ("pureuser", $pwd) |
| 52 | +$Targets = @('DEVOPSDEV1', 'DEVOPSDEV2') |
| 53 | + |
| 54 | +Invoke-PfaDbRefresh -RefreshDatabase tpch ` |
| 55 | + -RefreshSource DEVOPSPRD ` |
| 56 | + -DestSqlInstance $Targets ` |
| 57 | + -PfaEndpoint 10.223.112.05 ` |
| 58 | + -PfaCredentials $Creds ` |
| 59 | + -ApplyDataMasks |
| 60 | + |
| 61 | +## Restrictions |
| 62 | + |
| 63 | +- This code assumes that each database resides in its own volume, i.e. there is one window logical volume per database |
| 64 | +- The code does not work with database that reside on SQL Server fail over instances |
| 65 | +- The code assumes that the volumes used by all database reside on the same FlashArray |
| 66 | + |
| 67 | +## Authors |
| 68 | + |
| 69 | +Chris Adkin, EMEA SQL Server Solutions Architect at Pure Storage. |
| 70 | + |
| 71 | +## License |
| 72 | + |
| 73 | +This module is available to use under the Apache 2.0 license, stipulated as follows: |
| 74 | + |
| 75 | +Copyright 2018 Pure Storage, Inc. |
| 76 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 77 | +you may not use this file except in compliance with the License. |
| 78 | +You may obtain a copy of the License at |
| 79 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 80 | +Unless required by applicable law or agreed to in writing, software |
| 81 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 82 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 83 | +See the License for the specific language governing permissions and |
| 84 | +limitations under the License. |
| 85 | + |
| 86 | +## Acknowledgements |
| 87 | + |
| 88 | +Thanks to the community behind the dbatools module . |
| 89 | + |
| 90 | +## Links |
| 91 | + |
| 92 | +https://www.powershellgallery.com/packages/PureStorageDbaTools |
| 93 | +https://www.purepowershellguy.com/?p=8431 |
0 commit comments