resolve conflicts

This commit is contained in:
shueybubbles
2019-05-14 14:35:24 -04:00
25 changed files with 1152 additions and 910 deletions
+443 -439
View File
@@ -1,439 +1,443 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
out/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
# publish/
# Publish Web Output
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# Windows Azure Build Output
csx/
*.build.csdef
# Windows Store app package directory
AppPackages/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Typescript v1 declaration files
typings/
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
/build
/Build
/deploy
/package
bin/
obj/
sql/
*/obj/debug
**/Debug
#ignore thumbnails created by windows
Thumbs.db
#Ignore files build by Visual Studio
*.obj
*.pdb
*.user
*.aps
*.pch
*.docstates
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.dbmdl
*.schemaview
*.tlh
*.cache
*.ilk
*.log
[Bb]in
[Dd]ebug*/
*.lib
*.sbr
obj/
[Rr]elease*/
_ReSharper*/
[Tt]est[Rr]esult*
*.docstates
*.swp
*.*~
*.gpState
*.ReSharper*
*.preflight
*.nocommit
#Ignore Recovery Files made by Excel
~$*.xlsx
*.rdl.data
*.jfm
#======================================================================================
# The below section could possibly be removed as these should be ignored by the above.
#======================================================================================
samples/in-memory/ticket-reservations/DemoWorkload/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
*.nupkg
samples/in-memory/ticket-reservations/packages/CircularGauge.1.0.0/CreatePackageFile.bat
*.suo
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/bin/Debug/PopulateAlwaysEncryptedData.exe
*.pdb
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/bin/Debug/PopulateAlwaysEncryptedData.vshost.exe
*.Cache
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/bin/Debug/PopulateAlwaysEncryptedData.exe.config
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
samples/databases/wide-world-importers/workload-drivers/vehicle-location-insert/MultithreadedInMemoryTableInsert/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
*.exe
samples/features/in-memory/iot-smart-grid/ConsoleClient/bin/Release/DataGenerator.dll
samples/features/in-memory/iot-smart-grid/ConsoleClient/bin/Release/Reports/PowerDashboard.pbix
samples/databases/wide-world-importers/wwi-integration-etl/Daily ETL/bin/Development/Daily ETL.ispac
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/obj/Release/PopulateAlwaysEncryptedData.csproj.FileListAbsolute.txt
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/bin/Release/PopulateAlwaysEncryptedData.vshost.exe.config
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/obj/Release/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
*.dll
samples/features/in-memory/ticket-reservations/DemoWorkload/obj/Release/DemoWorkload.FrmConfig.resources
samples/features/in-memory/ticket-reservations/DemoWorkload/bin/Release/DemoWorkload.vshost.exe.config
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/obj/Debug/PopulateAlwaysEncryptedData.csproj.FileListAbsolute.txt
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/bin/Debug/PopulateAlwaysEncryptedData.vshost.exe.config
*.zip
samples/features/in-memory/ticket-reservations/packages/CircularGauge.1.0.0/CreatePackageFile.bat
samples/features/in-memory/ticket-reservations/TicketReservations/TicketReservations.dbmdl
samples/databases/wide-world-importers/workload-drivers/vehicle-location-insert/MultithreadedInMemoryTableInsert/obj/Release/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
samples/databases/wide-world-importers/workload-drivers/vehicle-location-insert/MultithreadedInMemoryTableInsert/obj/Debug/MultithreadedInMemoryTableInsert.csproj.FileListAbsolute.txt
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/obj/Debug/PopulateAlwaysEncryptedData.Properties.Resources.resources
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/obj/Release/PopulateAlwaysEncryptedData.PopulateAlwaysEncryptedDataMain.resources
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/bin/Debug/PopulateAlwaysEncryptedData.vshost.exe.manifest
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/obj/Debug/PopulateAlwaysEncryptedData.PopulateAlwaysEncryptedDataMain.resources
samples/databases/wide-world-importers/workload-drivers/vehicle-location-insert/MultithreadedInMemoryTableInsert/obj/Release/MultithreadedInMemoryTableInsert.Properties.Resources.resources
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/obj/Release/PopulateAlwaysEncryptedData.Properties.Resources.resources
samples/features/in-memory/ticket-reservations/packages/CircularGauge.1.0.0/ReadMe.txt
*.dacpac
samples/features/in-memory/ticket-reservations/TicketReservations/obj/Release/Model.xml
samples/features/in-memory/ticket-reservations/DemoWorkload/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
*.dat
*.user
samples/features/in-memory/ticket-reservations/DemoWorkload/obj/Release/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
samples/databases/wide-world-importers/workload-drivers/vehicle-location-insert/MultithreadedInMemoryTableInsert/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
samples/features/in-memory/ticket-reservations/DemoWorkload/bin/Debug/DemoWorkload.vshost.exe.config
samples/features/in-memory/ticket-reservations/DemoWorkload/obj/Release/DemoWorkload.Properties.Resources.resources
samples/databases/wide-world-importers/wwi-integration-etl/Daily ETL/obj/Development/Project.params
samples/features/in-memory/ticket-reservations/DemoWorkload/obj/Debug/DemoWorkload.csproj.FileListAbsolute.txt
samples/features/in-memory/iot-smart-grid/Db/obj/Release/Model.xml
samples/applications/iot-smart-grid/DataGenerator/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
samples/databases/wide-world-importers/workload-drivers/order-insert/MultithreadedOrderInsert/bin/Debug/MultithreadedOrderInsert.exe.config
samples/features/in-memory/iot-smart-grid/ConsoleClient/bin/Release/ConsoleClient.exe.config
*.jfm
samples/features/in-memory/ticket-reservations/TicketReservations/bin/Release/TicketReservations.publish.sql
samples/applications/iot-smart-grid/ConsoleClient/bin/Release/ConsoleClient.exe.config
samples/applications/iot-smart-grid/Db/Db.dbmdl
samples/databases/wide-world-importers/workload-drivers/order-insert/MultithreadedOrderInsert/obj/Release/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
samples/databases/wide-world-importers/wwi-dw-ssdt/wwi-dw-ssdt/obj/Debug/Model.xml
samples/databases/wide-world-importers/wwi-dw-ssdt/wwi-dw-ssdt/WideWorldImportersDW.dbmdl
samples/features/in-memory/iot-smart-grid/WinFormsClient/bin/Release/Reports/PowerDashboard.pbix
samples/databases/wide-world-importers/wwi-ssdt/wwi-ssdt/WideWorldImporters.dbmdl
samples/databases/wide-world-importers/workload-drivers/order-insert/MultithreadedOrderInsert/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
samples/databases/wide-world-importers/wwi-ssasmd/wwi-ssasmd/bin/WWI-SSASMD.asdatabase
samples/applications/iot-smart-grid/Db/obj/Release/Db.sqlproj.FileListAbsolute.txt
*.manifest
samples/applications/iot-smart-grid/WinFormsClient/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
samples/databases/wide-world-importers/wwi-ssasmd/wwi-ssasmd/obj/Development/IncrementalShapshot.xml
samples/applications/iot-smart-grid/ConsoleClient/bin/Release/Reports/PowerDashboard.pbix
samples/applications/iot-smart-grid/Db/obj/Release/Model.xml
samples/databases/wide-world-importers/workload-drivers/order-insert/MultithreadedOrderInsert/obj/Release/MultithreadedOrderInsert.csproj.FileListAbsolute.txt
samples/applications/iot-smart-grid/ConsoleClient/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
samples/applications/iot-smart-grid/WinFormsClient/bin/Release/Client.exe.config
samples/databases/wide-world-importers/workload-drivers/order-insert/MultithreadedOrderInsert/bin/Release/MultithreadedOrderInsert.exe.config
samples/databases/wide-world-importers/workload-drivers/order-insert/MultithreadedOrderInsert/obj/Debug/MultithreadedInMemoryTableInsert.MultithreadedOrderInsertMain.resources
/samples/features/epm-framework/5.0/2Reporting/PolicyReports/PolicyEvaluationErrors.rdl.data
/samples/features/epm-framework/5.0/2Reporting/PolicyReports/PolicyEvaluationErrorDetails.rdl.data
/samples/features/epm-framework/5.0/2Reporting/PolicyReports/PolicyEvaluationDetails.rdl.data
/samples/features/epm-framework/5.0/2Reporting/PolicyReports/PolicyDetails.rdl.data
/samples/features/epm-framework/5.0/2Reporting/PolicyReports/PolicyDashboard.rdl.data
/samples/features/epm-framework/5.0/2Reporting/PolicyReports/bin/Debug
/samples/features/epm-framework/5.0/2Reporting/PolicyReports/PolicyDashboard - Backup.rdl
/samples/features/epm-framework/5.0/2Reporting/PolicyReports/PolicyDashboardFiltered.rdl.data
samples/features/sql-management-objects/src/out/CodeCoverage/CodeCoverage.config
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
out/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
# publish/
# Publish Web Output
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# Windows Azure Build Output
csx/
*.build.csdef
# Windows Store app package directory
AppPackages/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Typescript v1 declaration files
typings/
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
/build
/Build
/deploy
/package
bin/
obj/
sql/
*/obj/debug
**/Debug
#ignore thumbnails created by windows
Thumbs.db
#Ignore files build by Visual Studio
*.obj
*.pdb
*.user
*.aps
*.pch
*.docstates
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.dbmdl
*.schemaview
*.tlh
*.cache
*.ilk
*.log
[Bb]in
[Dd]ebug*/
*.lib
*.sbr
obj/
[Rr]elease*/
_ReSharper*/
[Tt]est[Rr]esult*
*.docstates
*.swp
*.*~
*.gpState
*.ReSharper*
*.preflight
*.nocommit
#Ignore Recovery Files made by Excel
~$*.xlsx
*.rdl.data
*.jfm
#======================================================================================
# The below section could possibly be removed as these should be ignored by the above.
#======================================================================================
samples/in-memory/ticket-reservations/DemoWorkload/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
*.nupkg
samples/in-memory/ticket-reservations/packages/CircularGauge.1.0.0/CreatePackageFile.bat
*.suo
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/bin/Debug/PopulateAlwaysEncryptedData.exe
*.pdb
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/bin/Debug/PopulateAlwaysEncryptedData.vshost.exe
*.Cache
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/bin/Debug/PopulateAlwaysEncryptedData.exe.config
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
samples/databases/wide-world-importers/workload-drivers/vehicle-location-insert/MultithreadedInMemoryTableInsert/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
*.exe
samples/features/in-memory/iot-smart-grid/ConsoleClient/bin/Release/DataGenerator.dll
samples/features/in-memory/iot-smart-grid/ConsoleClient/bin/Release/Reports/PowerDashboard.pbix
samples/databases/wide-world-importers/wwi-integration-etl/Daily ETL/bin/Development/Daily ETL.ispac
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/obj/Release/PopulateAlwaysEncryptedData.csproj.FileListAbsolute.txt
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/bin/Release/PopulateAlwaysEncryptedData.vshost.exe.config
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/obj/Release/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
*.dll
samples/features/in-memory/ticket-reservations/DemoWorkload/obj/Release/DemoWorkload.FrmConfig.resources
samples/features/in-memory/ticket-reservations/DemoWorkload/bin/Release/DemoWorkload.vshost.exe.config
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/obj/Debug/PopulateAlwaysEncryptedData.csproj.FileListAbsolute.txt
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/bin/Debug/PopulateAlwaysEncryptedData.vshost.exe.config
*.zip
samples/features/in-memory/ticket-reservations/packages/CircularGauge.1.0.0/CreatePackageFile.bat
samples/features/in-memory/ticket-reservations/TicketReservations/TicketReservations.dbmdl
samples/databases/wide-world-importers/workload-drivers/vehicle-location-insert/MultithreadedInMemoryTableInsert/obj/Release/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
samples/databases/wide-world-importers/workload-drivers/vehicle-location-insert/MultithreadedInMemoryTableInsert/obj/Debug/MultithreadedInMemoryTableInsert.csproj.FileListAbsolute.txt
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/obj/Debug/PopulateAlwaysEncryptedData.Properties.Resources.resources
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/obj/Release/PopulateAlwaysEncryptedData.PopulateAlwaysEncryptedDataMain.resources
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/bin/Debug/PopulateAlwaysEncryptedData.vshost.exe.manifest
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/obj/Debug/PopulateAlwaysEncryptedData.PopulateAlwaysEncryptedDataMain.resources
samples/databases/wide-world-importers/workload-drivers/vehicle-location-insert/MultithreadedInMemoryTableInsert/obj/Release/MultithreadedInMemoryTableInsert.Properties.Resources.resources
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/obj/Release/PopulateAlwaysEncryptedData.Properties.Resources.resources
samples/features/in-memory/ticket-reservations/packages/CircularGauge.1.0.0/ReadMe.txt
*.dacpac
samples/features/in-memory/ticket-reservations/TicketReservations/obj/Release/Model.xml
samples/features/in-memory/ticket-reservations/DemoWorkload/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
*.dat
*.user
samples/features/in-memory/ticket-reservations/DemoWorkload/obj/Release/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
samples/databases/wide-world-importers/workload-drivers/vehicle-location-insert/MultithreadedInMemoryTableInsert/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
samples/features/in-memory/ticket-reservations/DemoWorkload/bin/Debug/DemoWorkload.vshost.exe.config
samples/features/in-memory/ticket-reservations/DemoWorkload/obj/Release/DemoWorkload.Properties.Resources.resources
samples/databases/wide-world-importers/wwi-integration-etl/Daily ETL/obj/Development/Project.params
samples/features/in-memory/ticket-reservations/DemoWorkload/obj/Debug/DemoWorkload.csproj.FileListAbsolute.txt
samples/features/in-memory/iot-smart-grid/Db/obj/Release/Model.xml
samples/applications/iot-smart-grid/DataGenerator/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
samples/databases/wide-world-importers/workload-drivers/order-insert/MultithreadedOrderInsert/bin/Debug/MultithreadedOrderInsert.exe.config
samples/features/in-memory/iot-smart-grid/ConsoleClient/bin/Release/ConsoleClient.exe.config
*.jfm
samples/features/in-memory/ticket-reservations/TicketReservations/bin/Release/TicketReservations.publish.sql
samples/applications/iot-smart-grid/ConsoleClient/bin/Release/ConsoleClient.exe.config
samples/applications/iot-smart-grid/Db/Db.dbmdl
samples/databases/wide-world-importers/workload-drivers/order-insert/MultithreadedOrderInsert/obj/Release/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
samples/databases/wide-world-importers/wwi-dw-ssdt/wwi-dw-ssdt/obj/Debug/Model.xml
samples/databases/wide-world-importers/wwi-dw-ssdt/wwi-dw-ssdt/WideWorldImportersDW.dbmdl
samples/features/in-memory/iot-smart-grid/WinFormsClient/bin/Release/Reports/PowerDashboard.pbix
samples/databases/wide-world-importers/wwi-ssdt/wwi-ssdt/WideWorldImporters.dbmdl
samples/databases/wide-world-importers/workload-drivers/order-insert/MultithreadedOrderInsert/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
samples/databases/wide-world-importers/wwi-ssasmd/wwi-ssasmd/bin/WWI-SSASMD.asdatabase
samples/applications/iot-smart-grid/Db/obj/Release/Db.sqlproj.FileListAbsolute.txt
*.manifest
samples/applications/iot-smart-grid/WinFormsClient/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
samples/databases/wide-world-importers/wwi-ssasmd/wwi-ssasmd/obj/Development/IncrementalShapshot.xml
samples/applications/iot-smart-grid/ConsoleClient/bin/Release/Reports/PowerDashboard.pbix
samples/applications/iot-smart-grid/Db/obj/Release/Model.xml
samples/databases/wide-world-importers/workload-drivers/order-insert/MultithreadedOrderInsert/obj/Release/MultithreadedOrderInsert.csproj.FileListAbsolute.txt
samples/applications/iot-smart-grid/ConsoleClient/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
samples/applications/iot-smart-grid/WinFormsClient/bin/Release/Client.exe.config
samples/databases/wide-world-importers/workload-drivers/order-insert/MultithreadedOrderInsert/bin/Release/MultithreadedOrderInsert.exe.config
samples/databases/wide-world-importers/workload-drivers/order-insert/MultithreadedOrderInsert/obj/Debug/MultithreadedInMemoryTableInsert.MultithreadedOrderInsertMain.resources
/samples/features/epm-framework/5.0/2Reporting/PolicyReports/PolicyEvaluationErrors.rdl.data
/samples/features/epm-framework/5.0/2Reporting/PolicyReports/PolicyEvaluationErrorDetails.rdl.data
/samples/features/epm-framework/5.0/2Reporting/PolicyReports/PolicyEvaluationDetails.rdl.data
/samples/features/epm-framework/5.0/2Reporting/PolicyReports/PolicyDetails.rdl.data
/samples/features/epm-framework/5.0/2Reporting/PolicyReports/PolicyDashboard.rdl.data
/samples/features/epm-framework/5.0/2Reporting/PolicyReports/bin/Debug
/samples/features/epm-framework/5.0/2Reporting/PolicyReports/PolicyDashboard - Backup.rdl
/samples/features/epm-framework/5.0/2Reporting/PolicyReports/PolicyDashboardFiltered.rdl.data
samples/features/sql-management-objects/src/out/CodeCoverage/CodeCoverage.config
# Certificates
*.pem
*.p12
@@ -3,7 +3,7 @@
-- bigger - so you can see more impactful
-- Intelligent QP demonstrations (aka.ms/iqp)
--
-- Script last updated 10/02/2018
-- Script last updated 05/03/2019
--
-- Database backup source: aka.ms/wwibak
--
@@ -100,4 +100,4 @@ GO
UPDATE Fact.OrderHistoryExtended
SET [WWI Order ID] = [Order Key];
GO
GO
@@ -9,7 +9,17 @@
-- Email IntelligentQP@microsoft.com for questions\feedback
-- ******************************************************** --
USE WideWorldImportersDW;
USE [master];
GO
ALTER DATABASE [WideWorldImportersDW] SET COMPATIBILITY_LEVEL = 150;
GO
ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE;
GO
USE [WideWorldImportersDW];
GO
-- Compare execution time and distinct counts
@@ -0,0 +1,54 @@
-- ******************************************************** --
-- Batch mode Adaptive Join
-- See https://aka.ms/IQP for more background
-- Demo scripts: https://aka.ms/IQPDemos
-- This demo is on SQL Server 2017 and Azure SQL DB
-- Email IntelligentQP@microsoft.com for questions\feedback
-- ******************************************************** --
USE [master];
GO
ALTER DATABASE [WideWorldImportersDW] SET COMPATIBILITY_LEVEL = 140;
GO
ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE;
GO
USE [WideWorldImportersDW];
GO
-- Show with Live Query Stats
SELECT [fo].[Order Key], [si].[Lead Time Days], [fo].[Quantity]
FROM [Fact].[Order] AS [fo]
INNER JOIN [Dimension].[Stock Item] AS [si]
ON [fo].[Stock Item Key] = [si].[Stock Item Key]
WHERE [fo].[Quantity] = 360;
GO
-- Inserting quantity row that doesn't exist in the table yet
DELETE [Fact].[Order]
WHERE Quantity = 361;
INSERT [Fact].[Order]
([City Key], [Customer Key], [Stock Item Key], [Order Date Key], [Picked Date Key], [Salesperson Key], [Picker Key], [WWI Order ID], [WWI Backorder ID], Description, Package, Quantity, [Unit Price], [Tax Rate], [Total Excluding Tax], [Tax Amount], [Total Including Tax], [Lineage Key])
SELECT TOP 5 [City Key], [Customer Key], [Stock Item Key],
[Order Date Key], [Picked Date Key], [Salesperson Key],
[Picker Key], [WWI Order ID], [WWI Backorder ID],
Description, Package, 361, [Unit Price], [Tax Rate],
[Total Excluding Tax], [Tax Amount], [Total Including Tax],
[Lineage Key]
FROM [Fact].[Order];
GO
-- Show with Live Query Stats
SELECT [fo].[Order Key], [si].[Lead Time Days], [fo].[Quantity]
FROM [Fact].[Order] AS [fo]
INNER JOIN [Dimension].[Stock Item] AS [si]
ON [fo].[Stock Item Key] = [si].[Stock Item Key]
WHERE [fo].[Quantity] = 361;
GO
@@ -0,0 +1,46 @@
-- ******************************************************** --
-- Batch mode Memory Grant Feedback
-- See https://aka.ms/IQP for more background
-- Demo scripts: https://aka.ms/IQPDemos
-- This demo is on SQL Server 2017 and Azure SQL DB
-- Email IntelligentQP@microsoft.com for questions\feedback
-- ******************************************************** --
USE [master];
GO
ALTER DATABASE [WideWorldImportersDW] SET COMPATIBILITY_LEVEL = 140;
GO
ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE;
GO
USE [WideWorldImportersDW];
GO
-- Intentionally forcing a row underestimate
CREATE OR ALTER PROCEDURE [FactOrderByLineageKey]
@LineageKey INT
AS
SELECT [fo].[Order Key], [fo].[Description]
FROM [Fact].[Order] AS [fo]
INNER HASH JOIN [Dimension].[Stock Item] AS [si]
ON [fo].[Stock Item Key] = [si].[Stock Item Key]
WHERE [fo].[Lineage Key] = @LineageKey
AND [si].[Lead Time Days] > 0
ORDER BY [fo].[Stock Item Key], [fo].[Order Date Key] DESC
OPTION (MAXDOP 1);
GO
-- Compiled and executed using a lineage key that doesn't have rows
EXEC [FactOrderByLineageKey] 8;
GO
-- Execute this query a few times - each time looking at
-- the plan to see impact on spills, memory grant size, and run time
EXEC [FactOrderByLineageKey] 9;
GO
@@ -10,12 +10,18 @@
-- Email IntelligentQP@microsoft.com for questions\feedback
-- ******************************************************** --
USE [master];
GO
ALTER DATABASE [WideWorldImportersDW] SET COMPATIBILITY_LEVEL = 150;
GO
ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE;
GO
USE [WideWorldImportersDW];
GO
-- Row mode due to hint
SELECT [Tax Rate],
[Lineage Key],
@@ -0,0 +1,173 @@
-- ******************************************************** --
-- Interleaved Execution
-- See https://aka.ms/IQP for more background
-- Demo scripts: https://aka.ms/IQPDemos
-- This demo is on SQL Server 2017 and Azure SQL DB
-- Email IntelligentQP@microsoft.com for questions\feedback
-- ******************************************************** --
/*
Create MSTVF
*/
USE [WideWorldImportersDW];
GO
CREATE FUNCTION [Fact].[WhatIfOutlierEventQuantity](@event VARCHAR(15), @beginOrderDateKey DATE, @endOrderDateKey DATE)
RETURNS @OutlierEventQuantity TABLE (
[Order Key] [bigint],
[City Key] [int] NOT NULL,
[Customer Key] [int] NOT NULL,
[Stock Item Key] [int] NOT NULL,
[Order Date Key] [date] NOT NULL,
[Picked Date Key] [date] NULL,
[Salesperson Key] [int] NOT NULL,
[Picker Key] [int] NULL,
[OutlierEventQuantity] [int] NOT NULL)
AS
BEGIN
-- Valid @event values
-- 'Mild Recession'
-- 'Hurricane - South Atlantic'
-- 'Hurricane - East South Central'
-- 'Hurricane - West South Central'
IF @event = 'Mild Recession'
INSERT @OutlierEventQuantity
SELECT [o].[Order Key], [o].[City Key], [o].[Customer Key],
[o].[Stock Item Key], [o].[Order Date Key], [o].[Picked Date Key],
[o].[Salesperson Key], [o].[Picker Key],
CASE
WHEN [o].[Quantity] > 2 THEN [o].[Quantity] * .5
ELSE [o].[Quantity]
END
FROM [Fact].[Order] AS [o]
INNER JOIN [Dimension].[City] AS [c]
ON [c].[City Key] = [o].[City Key]
IF @event = 'Hurricane - South Atlantic'
INSERT @OutlierEventQuantity
SELECT [o].[Order Key], [o].[City Key], [o].[Customer Key],
[o].[Stock Item Key], [o].[Order Date Key], [o].[Picked Date Key],
[o].[Salesperson Key], [o].[Picker Key],
CASE
WHEN [o].[Quantity] > 10 THEN [o].[Quantity] * .5
ELSE [o].[Quantity]
END
FROM [Fact].[Order] AS [o]
INNER JOIN [Dimension].[City] AS [c]
ON [c].[City Key] = [o].[City Key]
WHERE [c].[State Province] IN
('Florida', 'Georgia', 'Maryland', 'North Carolina',
'South Carolina', 'Virginia', 'West Virginia',
'Delaware')
AND [o].[Order Date Key] BETWEEN @beginOrderDateKey AND @endOrderDateKey
IF @event = 'Hurricane - East South Central'
INSERT @OutlierEventQuantity
SELECT [o].[Order Key], [o].[City Key], [o].[Customer Key],
[o].[Stock Item Key], [o].[Order Date Key], [o].[Picked Date Key],
[o].[Salesperson Key], [o].[Picker Key],
CASE
WHEN [o].[Quantity] > 50 THEN [o].[Quantity] * .5
ELSE [o].[Quantity]
END
FROM [Fact].[Order] AS [o]
INNER JOIN [Dimension].[City] AS [c]
ON [c].[City Key] = [o].[City Key]
INNER JOIN [Dimension].[Stock Item] AS [si]
ON [si].[Stock Item Key] = [o].[Stock Item Key]
WHERE [c].[State Province] IN
('Alabama', 'Kentucky', 'Mississippi', 'Tennessee')
AND [si].[Buying Package] = 'Carton'
AND [o].[Order Date Key] BETWEEN @beginOrderDateKey AND @endOrderDateKey
IF @event = 'Hurricane - West South Central'
INSERT @OutlierEventQuantity
SELECT [o].[Order Key], [o].[City Key], [o].[Customer Key],
[o].[Stock Item Key], [o].[Order Date Key], [o].[Picked Date Key],
[o].[Salesperson Key], [o].[Picker Key],
CASE
WHEN [cu].[Customer] = 'Unknown' THEN 0
WHEN [cu].[Customer] <> 'Unknown' AND
[o].[Quantity] > 10 THEN [o].[Quantity] * .5
ELSE [o].[Quantity]
END
FROM [Fact].[Order] AS [o]
INNER JOIN [Dimension].[City] AS [c]
ON [c].[City Key] = [o].[City Key]
INNER JOIN [Dimension].[Customer] AS [cu]
ON [cu].[Customer Key] = [o].[Customer Key]
WHERE [c].[State Province] IN
('Arkansas', 'Louisiana', 'Oklahoma', 'Texas')
AND [o].[Order Date Key] BETWEEN @beginOrderDateKey AND @endOrderDateKey
RETURN
END
GO
USE [master];
GO
ALTER DATABASE [WideWorldImportersDW] SET COMPATIBILITY_LEVEL = 130;
GO
ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE;
GO
USE [WideWorldImportersDW];
GO
SELECT [fo].[Order Key], [fo].[Description], [fo].[Package],
[fo].[Quantity], [foo].[OutlierEventQuantity]
FROM [Fact].[Order] AS [fo]
INNER JOIN [Fact].[WhatIfOutlierEventQuantity]('Mild Recession',
'1-01-2013',
'10-15-2014') AS [foo] ON [fo].[Order Key] = [foo].[Order Key]
AND [fo].[City Key] = [foo].[City Key]
AND [fo].[Customer Key] = [foo].[Customer Key]
AND [fo].[Stock Item Key] = [foo].[Stock Item Key]
AND [fo].[Order Date Key] = [foo].[Order Date Key]
AND [fo].[Picked Date Key] = [foo].[Picked Date Key]
AND [fo].[Salesperson Key] = [foo].[Salesperson Key]
AND [fo].[Picker Key] = [foo].[Picker Key]
INNER JOIN [Dimension].[Stock Item] AS [si]
ON [fo].[Stock Item Key] = [si].[Stock Item Key]
WHERE [si].[Lead Time Days] > 0
AND [fo].[Quantity] > 50;
GO
USE [master];
GO
ALTER DATABASE [WideWorldImportersDW] SET COMPATIBILITY_LEVEL = 140;
GO
ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE;
GO
USE [WideWorldImportersDW];
GO
SELECT [fo].[Order Key], [fo].[Description], [fo].[Package],
[fo].[Quantity], [foo].[OutlierEventQuantity]
FROM [Fact].[Order] AS [fo]
INNER JOIN [Fact].[WhatIfOutlierEventQuantity]('Mild Recession',
'1-01-2013',
'10-15-2014') AS [foo] ON [fo].[Order Key] = [foo].[Order Key]
AND [fo].[City Key] = [foo].[City Key]
AND [fo].[Customer Key] = [foo].[Customer Key]
AND [fo].[Stock Item Key] = [foo].[Stock Item Key]
AND [fo].[Order Date Key] = [foo].[Order Date Key]
AND [fo].[Picked Date Key] = [foo].[Picked Date Key]
AND [fo].[Salesperson Key] = [foo].[Salesperson Key]
AND [fo].[Picker Key] = [foo].[Picker Key]
INNER JOIN [Dimension].[Stock Item] AS [si]
ON [fo].[Stock Item Key] = [si].[Stock Item Key]
WHERE [si].[Lead Time Days] > 0
AND [fo].[Quantity] > 50;
GO
@@ -10,13 +10,16 @@
-- Email IntelligentQP@microsoft.com for questions\feedback
-- ******************************************************** --
ALTER DATABASE WideWorldImportersDW SET COMPATIBILITY_LEVEL = 150;
USE [master];
GO
ALTER DATABASE [WideWorldImportersDW] SET COMPATIBILITY_LEVEL = 150;
GO
ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE;
GO
USE WideWorldImportersDW;
USE [WideWorldImportersDW];
GO
-- Simulate out-of-date stats
@@ -30,10 +33,10 @@ GO
SELECT
fo.[Order Key], fo.Description,
si.[Lead Time Days]
FROM Fact.OrderHistory AS fo
FROM Fact.OrderHistory AS fo
INNER HASH JOIN Dimension.[Stock Item] AS si
ON fo.[Stock Item Key] = si.[Stock Item Key]
WHERE fo.[Lineage Key] = 9
WHERE fo.[Lineage Key] = 9
AND si.[Lead Time Days] > 19;
-- Cleanup
@@ -9,19 +9,21 @@
-- Email IntelligentQP@microsoft.com for questions\feedback
-- ******************************************************** --
USE WideWorldImportersDW;
USE [master];
GO
ALTER DATABASE WideWorldImportersDW
SET COMPATIBILITY_LEVEL = 150;
ALTER DATABASE [WideWorldImportersDW] SET COMPATIBILITY_LEVEL = 150;
GO
ALTER DATABASE SCOPED CONFIGURATION
CLEAR PROCEDURE_CACHE;
ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE;
GO
USE [WideWorldImportersDW];
GO
/*
Adapted from SQL Server Books Online
https://docs.microsoft.com/en-us/sql/relational-databases/user-defined-functions/scalar-udf-inlining?view=sqlallproducts-allversions
https://docs.microsoft.com/sql/relational-databases/user-defined-functions/scalar-udf-inlining?view=sqlallproducts-allversions
*/
CREATE OR ALTER FUNCTION
dbo.customer_category(@CustomerKey INT)
@@ -13,7 +13,10 @@
USE [master];
GO
ALTER DATABASE [WideWorldImportersDW] SET COMPATIBILITY_LEVEL = 140;
ALTER DATABASE [WideWorldImportersDW] SET COMPATIBILITY_LEVEL = 150;
GO
ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE;
GO
USE [WideWorldImportersDW];
@@ -8,6 +8,9 @@ Here are the instructions to prepare for demonstrating Intelligent QP's latest r
Demos (with more on the way!):
- [Batch Mode Adaptive Join](Intelligent%20QP%20Demos%20WideWorldImportersDW%20Public%20Preview%20-%20Batch%20Mode%20Adaptive%20Join.sql)
- [Interleaved Execution](Intelligent%20QP%20Demos%20WideWorldImportersDW%20Public%20Preview%20-%20Interleaved%20Execution.sql)
- [Batch mode memory grant feedback](Intelligent%20QP%20Demos%20WideWorldImportersDW%20Public%20Preview%20-%20Batch%20Mode%20MGF.sql)
- [Row mode memory grant feedback](Intelligent%20QP%20Demos%20WideWorldImportersDW%20Public%20Preview%20-%20Row%20Mode%20MGF.sql)
- [Batch mode on rowstore](Intelligent%20QP%20Demos%20WideWorldImportersDW%20Public%20Preview%20-%20Batch%20Mode%20on%20Rowstore.sql)
- [APPROX_COUNT_DISTINCT](Intelligent%20QP%20Demos%20WideWorldImportersDW%20Public%20Preview%20-%20APPROX_COUNT_DISTINCT.sql)
@@ -46,7 +46,7 @@ if /i "%CTP_VERSION%" EQU "CTP2.4" (set MASTER_POD_NAME=mssql-master-pool-0) els
REM Copy the backup file, restore the database, create necessary objects and data file
echo Copying sales database backup file to SQL Master instance...
%DEBUG% kubectl cp tpcxbb_1gb.bak %CLUSTER_NAMESPACE%/%MASTER_POD_NAME%:/var/opt/mssql/data -c mssql-server || goto exit
%DEBUG% kubectl cp tpcxbb_1gb.bak %CLUSTER_NAMESPACE%/%MASTER_POD_NAME%:var/opt/mssql/data -c mssql-server || goto exit
REM Download and copy the sample backup files
if /i "%AW_WWI_SAMPLES%" EQU "--install-extra-samples" (
@@ -57,7 +57,7 @@ if /i "%AW_WWI_SAMPLES%" EQU "--install-extra-samples" (
%DEBUG% curl -L -G "https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/%%f" -o %%f
)
echo Copying %%f database backup file to SQL Master instance...
%DEBUG% kubectl cp %%f %CLUSTER_NAMESPACE%/%MASTER_POD_NAME%:/var/opt/mssql/data -c mssql-server || goto exit
%DEBUG% kubectl cp %%f %CLUSTER_NAMESPACE%/%MASTER_POD_NAME%:var/opt/mssql/data -c mssql-server || goto exit
)
set FILES=WideWorldImporters-Full.bak WideWorldImportersDW-Full.bak
@@ -67,7 +67,7 @@ if /i "%AW_WWI_SAMPLES%" EQU "--install-extra-samples" (
%DEBUG% curl -L -G "https://github.com/Microsoft/sql-server-samples/releases/download/wide-world-importers-v1.0/%%f" -o %%f
)
echo Copying %%f database backup file to SQL Master instance...
%DEBUG% kubectl cp %%f %CLUSTER_NAMESPACE%/%MASTER_POD_NAME%:/var/opt/mssql/data -c mssql-server || goto exit
%DEBUG% kubectl cp %%f %CLUSTER_NAMESPACE%/%MASTER_POD_NAME%:var/opt/mssql/data -c mssql-server || goto exit
)
)
@@ -60,8 +60,8 @@ else
MASTER_POD_NAME=master-0
fi
echo Copying database backup file...
$DEBUG kubectl cp tpcxbb_1gb.bak $CLUSTER_NAMESPACE/$MASTER_POD_NAME:/var/opt/mssql/data -c mssql-server || (echo $ERROR_MESSAGE && exit 1)
echo Copying sales database backup file...
$DEBUG kubectl cp tpcxbb_1gb.bak $CLUSTER_NAMESPACE/$MASTER_POD_NAME:var/opt/mssql/data -c mssql-server || (echo $ERROR_MESSAGE && exit 1)
# $DEBUG rm tpcxbb_1gb.bak
if [ "$AW_WWI_SAMPLES" == "--install-extra-samples" ]
@@ -74,7 +74,7 @@ then
$DEBUG curl -L -G "https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/$file" -o $file
fi
echo Copying $file database backup file to SQL Master instance...
$DEBUG kubectl cp $file $CLUSTER_NAMESPACE/$MASTER_POD_NAME:/var/opt/mssql/data -c mssql-server || (echo $ERROR_MESSAGE && exit 1)
$DEBUG kubectl cp $file $CLUSTER_NAMESPACE/$MASTER_POD_NAME:var/opt/mssql/data -c mssql-server || (echo $ERROR_MESSAGE && exit 1)
done
@@ -86,7 +86,7 @@ then
$DEBUG curl -L -G "https://github.com/Microsoft/sql-server-samples/releases/download/wide-world-importers-v1.0/$file" -o $file
fi
echo Copying $file database backup file to SQL Master instance...
$DEBUG kubectl cp $file $CLUSTER_NAMESPACE/$MASTER_POD_NAME:/var/opt/mssql/data -c mssql-server || (echo $ERROR_MESSAGE && exit 1)
$DEBUG kubectl cp $file $CLUSTER_NAMESPACE/$MASTER_POD_NAME:var/opt/mssql/data -c mssql-server || (echo $ERROR_MESSAGE && exit 1)
done
fi
@@ -97,7 +97,7 @@ $DEBUG sqlcmd -S $SQL_MASTER_INSTANCE -Usa -P$SQL_MASTER_SA_PASSWORD -I -b < "$S
# remove files copied into the pod:
echo Removing database backup files...
kubectl exec $MASTER_POD_NAME -n $CLUSTER_NAMESPACE -c mssql-server -i -t -- bash -c "rm -rvf /var/opt/mssql/data/*.bak"
$DEBUG kubectl exec $MASTER_POD_NAME -n $CLUSTER_NAMESPACE -c mssql-server -i -t -- bash -c "rm -rvf /var/opt/mssql/data/*.bak"
for table in web_clickstreams inventory customer
do
@@ -70,8 +70,8 @@ GO
CREATE OR ALTER PROCEDURE #create_data_sources
AS
BEGIN
-- Create database master key (required for database scoped credentials used in the samples)
IF NOT EXISTS(SELECT * FROM sys.databases WHERE name = DB_NAME() and is_master_key_encrypted_by_server = 1)
-- Create database master key (required for database scoped credentials used in the samples)
IF NOT EXISTS(SELECT * FROM sys.symmetric_keys WHERE name = '##MS_DatabaseMasterKey##')
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'sql19bigdatacluster!';
-- Create default data sources for SQL Big Data Cluster
@@ -4,16 +4,15 @@
-- the Query menu, and "Specify Values for Template Parameters" option.
IF NOT EXISTS(SELECT * FROM sys.database_scoped_credentials WHERE name = 'MySQL80-user')
CREATE DATABASE SCOPED CREDENTIAL [MySQL80-user]
WITH IDENTITY = 'mssql-user'
, SECRET = 'sql19tw0mysql';
WITH IDENTITY = '<mysql_user,nvarchar(100),mssql-user>'
, SECRET = '<mysql_user_password,nvarchar(100),sql19tw0mysql>';
-- Create external data source that points to MySQL server
-- The tokens '%u' and '%p' is used to reference the credential information.
-- Create external data source that points to MySQL server.
--
IF NOT EXISTS(SELECT * FROM sys.external_data_sources WHERE name = 'MySQL80')
CREATE EXTERNAL DATA SOURCE MySQL80
WITH (LOCATION = 'odbc://uc-win19-vm.redmond.corp.microsoft.com'
, CONNECTION_OPTIONS = 'Driver={MySQL ODBC 8.0 Unicode Driver};User name=%u;Passwword=%p;IGNORE_SPACE=1'
WITH (LOCATION = 'odbc://<mysql_server,nvarchar(100),mysql-server-name>'
, CONNECTION_OPTIONS = 'Driver={MySQL ODBC 8.0 Unicode Driver};IGNORE_SPACE=1'
, CREDENTIAL = [MySQL80-user]);
-- Create external table over inventory table on MySQL server
@@ -7,13 +7,12 @@ IF NOT EXISTS(SELECT * FROM sys.database_scoped_credentials WHERE name = 'Postgr
WITH IDENTITY = '<postgres_user,nvarchar(100),mssql-user>'
, SECRET = '<postgres_user_password,nvarchar(100),sql19tw0postgresql>';
-- Create external data source that points to PostgreSQL server
-- The tokens '%u' and '%p' is used to reference the credential information.
-- Create external data source that points to PostgreSQL server.
--
IF NOT EXISTS(SELECT * FROM sys.external_data_sources WHERE name = 'PostgreSQL11')
CREATE EXTERNAL DATA SOURCE PostgreSQL11
WITH (LOCATION = 'odbc://<postgres_server,nvarchar(100),postgres-server-name>'
, CONNECTION_OPTIONS = 'Driver={PostgreSQL ODBC Driver(UNICODE)};User name=%u;Passwword=%p'
, CONNECTION_OPTIONS = 'Driver={PostgreSQL ODBC Driver(UNICODE)}'
, CREDENTIAL = [PostgreSQL11-user]);
-- Create external table over inventory table on PostgreSQL server
@@ -203,7 +203,7 @@
},
{
"cell_type": "markdown",
"source": "# Configuration settings for scaling to larger data\n\n## Number and size of nodes in our Kubernetes cluster\nWe can control the number and size of nodes in our Kubernetes cluster via the node-vm-size and node-count switches in our `aks create` command:\n\n`az aks create --name mycluster --resource-group myrg --generate-ssh-keys --node-vm-size Standard_DS14_v2 --node-count 3 --kubernetes-version 1.10.9`\n\nMore information is available [here](https://docs.microsoft.com/en-us/sql/big-data-cluster/deploy-on-aks?view=sqlallproducts-allversions#create-a-kubernetes-cluster).\n\n## Number of Spark pods\nWe can control the number of Spark pods via the CLUSTER_STORAGE_POOL_REPLICAS environment variable used by `mssqlctl create cluster`:\n\nSET CLUSTER_STORAGE_POOL_REPLICAS=2\n\n## YARN scheduler memory and cores\nWe can control the YARN scheduler memory and cores via the following environment variable used by `mssqlctl create cluster`:\n\n- YARN_SCHEDULER_MAX_MEMORY\n- YARN_SCHEDULER_MAX_VCORES\n- YARN_NODEMANAGER_RESOURCE_MEMORY\n- YARN_NODEMANAGER_RESOURCE_VCORES\n\nFurther information regarding mssqlctl environtment variables is available [here](https://docs.microsoft.com/en-us/sql/big-data-cluster/deployment-guidance?view=sqlallproducts-allversions#define-environment-variables).\n\n## Livy timeout\nThe Livy timeout sets a limit on the runtime of a cell in a PySpark3 Jupyter notebook. In SQL Server 2019 Big Data CTP 2.1, the Livy timeout defaults to 1 hour. In CTP 2.2, it defaults to 24 days. One can modify this as follows:\n\n- Log into the mssql-master-pool-0 pod using this command (requires permission to run kubectl):\n\n```\nkubectl exec -it mssql-master-pool-0 -n <your-cluster-name> -- /bin/bash\n```\n- To set the Livy timeout to 24 days, run the following command or edit /livy/conf/livy.conf accordingly:\n\n```\necho 'livy.server.session.timeout = 24d' | cat >> /livy/conf/livy.conf \n```\n- Then restart the Livy server by running the following command:\n\n```\nsupervisorctl restart livy\n```",
"source": "# Configuration settings for scaling to larger data\n\n## Number and size of nodes in our Kubernetes cluster\nWe can control the number and size of nodes in our Kubernetes cluster via the node-vm-size and node-count switches in our `aks create` command:\n\n`az aks create --name mycluster --resource-group myrg --generate-ssh-keys --node-vm-size Standard_DS14_v2 --node-count 3 --kubernetes-version 1.10.9`\n\nMore information is available [here](https://docs.microsoft.com/en-us/sql/big-data-cluster/deploy-on-aks?view=sqlallproducts-allversions#create-a-kubernetes-cluster).\n\n## Number of Spark pods\nWe can control the number of Spark pods via the CLUSTER_STORAGE_POOL_REPLICAS environment variable used by `mssqlctl create cluster`:\n\nSET CLUSTER_STORAGE_POOL_REPLICAS=2\n\n## YARN scheduler memory and cores\nWe can control the YARN scheduler memory and cores via the following environment variable used by `mssqlctl create cluster`:\n\n- YARN_SCHEDULER_MAX_MEMORY\n- YARN_SCHEDULER_MAX_VCORES\n- YARN_NODEMANAGER_RESOURCE_MEMORY\n- YARN_NODEMANAGER_RESOURCE_VCORES\n\nFurther information regarding mssqlctl environtment variables is available [here](https://docs.microsoft.com/en-us/sql/big-data-cluster/deployment-guidance?view=sqlallproducts-allversions#define-environment-variables).\n\nIn CTP 2.5 and later, these environment variables are replaced by similarly named properties in a JSON file. See [Custom configurations](https://docs.microsoft.com/en-us/sql/big-data-cluster/deployment-guidance?view=sqlallproducts-allversions#customconfig).\n\n## Livy timeout\nThe Livy timeout sets a limit on the runtime of a cell in a PySpark3 Jupyter notebook. In SQL Server 2019 Big Data CTP 2.1, the Livy timeout defaults to 1 hour. In CTP 2.2, it defaults to 24 days. One can modify this as follows:\n\n- Log into the mssql-master-pool-0 pod using this command (requires permission to run kubectl):\n\n```\nkubectl exec -it mssql-master-pool-0 -n <your-cluster-name> -- /bin/bash\n```\n- To set the Livy timeout to 24 days, run the following command or edit /livy/conf/livy.conf accordingly:\n\n```\necho 'livy.server.session.timeout = 24d' | cat >> /livy/conf/livy.conf \n```\n- Then restart the Livy server by running the following command:\n\n```\nsupervisorctl restart livy\n```",
"metadata": {}
},
{
@@ -29,8 +29,8 @@ To run this sample, you need the following prerequisites.
**Software prerequisites:**
1. PowerShell 5.1
2. Azure PowerShell 5.4.2 or higher
1. PowerShell 5.1 or PowerShell Core 6.0
2. Azure PowerShell Az module
**Azure prerequisites:**
@@ -40,7 +40,7 @@ To run this sample, you need the following prerequisites.
## Run this sample
Run the script below from Windows PowerShell or Azure Cloud Shell
Run the script below from PowerShell or Azure Cloud Shell
```powershell
@@ -1,47 +1,69 @@
$parameters = $args[0]
$scriptUrlBase = $args[1]
$subscriptionId = $parameters['subscriptionId']
$resourceGroupName = $parameters['resourceGroupName']
$virtualMachineName = $parameters['virtualMachineName']
$virtualNetworkName = $parameters['virtualNetworkName']
$managementSubnetName = $parameters['subnetName']
$administratorLogin = $parameters['administratorLogin']
$administratorLoginPassword = $parameters['administratorLoginPassword']
$administratorLogin = $parameters['administratorLogin']
$administratorLoginPassword = $parameters['administratorLoginPassword']
$scriptUrlBase = $args[1]
if($virtualMachineName -eq '' -or $virtualMachineName -eq $null) {
if ($virtualMachineName -eq '' -or ($null -eq $virtualMachineName)) {
$virtualMachineName = 'Jumpbox'
Write-Host "VM Name: 'Jumpbox'." -ForegroundColor Green
}
if($managementSubnetName -eq '' -or $managementSubnetName -eq $null) {
if ($managementSubnetName -eq '' -or ($null -eq $managementSubnetName)) {
$managementSubnetName = 'Management'
Write-Host "Using subnet 'Management' to deploy jumpbox VM." -ForegroundColor Green
}
function VerifyPSVersion
{
Write-Host "Verifying PowerShell version, must be 5.0 or higher."
if($PSVersionTable.PSVersion.Major -ge 5)
{
Write-Host "PowerShell version verified." -ForegroundColor Green
function VerifyPSVersion {
Write-Host "Verifying PowerShell version."
if ($PSVersionTable.PSEdition -eq "Desktop") {
if (($PSVersionTable.PSVersion.Major -ge 6) -or
(($PSVersionTable.PSVersion.Major -eq 5) -and ($PSVersionTable.PSVersion.Minor -ge 1))) {
Write-Host "PowerShell version verified." -ForegroundColor Green
}
else {
Write-Host "You need to install PowerShell version 5.1 or heigher." -ForegroundColor Red
Break;
}
}
else
{
Write-Host "You need to install PowerShell version 5.0 or heigher." -ForegroundColor Red
Break;
else {
if ($PSVersionTable.PSVersion.Major -ge 6) {
Write-Host "PowerShell version verified." -ForegroundColor Green
}
else {
Write-Host "You need to install PowerShell version 6.0 or heigher." -ForegroundColor Red
Break;
}
}
}
function EnsureLogin ()
{
$context = Get-AzureRmContext
If($null -eq $context.Subscription)
{
function EnsureAzModule {
Write-Host "Checking if Az module is imported."
$module = Get-Module Az
If ($null -eq $module) {
try {
Import-Module Az -ErrorAction Stop
Write-Host "Module Az imported." -ForegroundColor Green
}
catch {
Install-Module Az -AllowClobber
Write-Host "Module Az installed." -ForegroundColor Green
}
} else {
Write-Host "Module Az imported." -ForegroundColor Green
}
}
function EnsureLogin () {
$context = Get-AzContext
If ($null -eq $context.Subscription) {
Write-Host "Sign-in..."
If($null -eq (Login-AzureRmAccount -ErrorAction SilentlyContinue -ErrorVariable Errors))
{
If ($null -eq (Connect-AzAccount -ErrorAction SilentlyContinue -ErrorVariable Errors)) {
Write-Host ("Sign-in failed: {0}" -f $Errors[0].Exception.Message) -ForegroundColor Red
Break
}
@@ -54,16 +76,14 @@ function SelectSubscriptionId {
$subscriptionId
)
Write-Host "Selecting subscription '$subscriptionId'..."
$context = Get-AzureRmContext
If($context.Subscription.Id -ne $subscriptionId)
{
Try
{
Write-Host "Switching subscription $context.Subscription.Id to '$subscriptionId'." -ForegroundColor Green
Select-AzureRmSubscription -SubscriptionId $subscriptionId -ErrorAction Stop | Out-null
$context = Get-AzContext
If ($context.Subscription.Id -ne $subscriptionId) {
Try {
$currentSubscriptionId = $context.Subscription.Id
Write-Host "Switching subscription $currentSubscriptionId to '$subscriptionId'." -ForegroundColor Green
Select-AzSubscription -SubscriptionId $subscriptionId -ErrorAction Stop | Out-null
}
Catch
{
Catch {
Write-Host "Subscription selection failed: $_" -ForegroundColor Red
Break
}
@@ -76,59 +96,52 @@ function LoadVirtualNetwork {
$resourceGroupName,
$virtualNetworkName
)
Write-Host("Loading virtual network '{0}' in resource group '{1}'." -f $virtualNetworkName, $resourceGroupName)
$virtualNetwork = Get-AzureRmVirtualNetwork -ResourceGroupName $resourceGroupName -Name $virtualNetworkName -ErrorAction SilentlyContinue
$id = $virtualNetwork.Id
If($null -ne $id)
{
Write-Host "Virtual network with id $id is loaded." -ForegroundColor Green
If($virtualNetwork.VirtualNetworkPeerings.Count -gt 0) {
Write-Host "Virtual network is loaded, but it should not have peerings." -ForegroundColor Red
}
return $virtualNetwork
}
else
{
Write-Host "Virtual network $virtualNetworkName cannot be found." -ForegroundColor Red
Break
Write-Host("Loading virtual network '{0}' in resource group '{1}'." -f $virtualNetworkName, $resourceGroupName)
$virtualNetwork = Get-AzVirtualNetwork -ResourceGroupName $resourceGroupName -Name $virtualNetworkName -ErrorAction SilentlyContinue
$id = $virtualNetwork.Id
If ($null -ne $id) {
Write-Host "Virtual network with id $id is loaded." -ForegroundColor Green
If ($virtualNetwork.VirtualNetworkPeerings.Count -gt 0) {
Write-Host "Virtual network is loaded, but it should not have peerings." -ForegroundColor Red
}
return $virtualNetwork
}
else {
Write-Host "Virtual network $virtualNetworkName cannot be found." -ForegroundColor Red
Break
}
}
function SetVirtualNetwork
{
function SetVirtualNetwork {
param($virtualNetwork)
Write-Host "Applying changes to the virtual network."
Try
{
Set-AzureRmVirtualNetwork -VirtualNetwork $virtualNetwork -ErrorAction Stop | Out-Null
Try {
Set-AzVirtualNetwork -VirtualNetwork $virtualNetwork -ErrorAction Stop | Out-Null
}
Catch
{
Catch {
Write-Host "Failed to configure Virtual Network: $_" -ForegroundColor Red
}
}
function ConvertCidrToUint32Array
{
function ConvertCidrToUint32Array {
param($cidrRange)
$cidrRangeParts = $cidrRange.Split("/")
$ipParts = $cidrRangeParts[0].Split(".")
$ipnum = ([Convert]::ToUInt32($ipParts[0]) -shl 24) -bor `
([Convert]::ToUInt32($ipParts[1]) -shl 16) -bor `
([Convert]::ToUInt32($ipParts[2]) -shl 8) -bor `
[Convert]::ToUInt32($ipParts[3])
([Convert]::ToUInt32($ipParts[1]) -shl 16) -bor `
([Convert]::ToUInt32($ipParts[2]) -shl 8) -bor `
[Convert]::ToUInt32($ipParts[3])
$maskbits = [System.Convert]::ToInt32($cidrRangeParts[1])
$mask = 0xffffffff
$mask = $mask -shl (32 -$maskbits)
$mask = $mask -shl (32 - $maskbits)
$ipstart = $ipnum -band $mask
$ipend = $ipnum -bor ($mask -bxor 0xffffffff)
return @($ipstart, $ipend)
}
function ConvertUInt32ToIPAddress
{
function ConvertUInt32ToIPAddress {
param($uint32IP)
$v1 = $uint32IP -band 0xff
$v2 = ($uint32IP -shr 8) -band 0xff
@@ -137,16 +150,13 @@ function ConvertUInt32ToIPAddress
return "$v4.$v3.$v2.$v1"
}
function CalculateNextAddressPrefix
{
function CalculateNextAddressPrefix {
param($virtualNetwork, $prefixLength)
Write-Host "Calculating address prefix with length $prefixLength..."
$startIPAddress = 0
ForEach($addressPrefix in $virtualNetwork.AddressSpace.AddressPrefixes)
{
ForEach ($addressPrefix in $virtualNetwork.AddressSpace.AddressPrefixes) {
$endIPAddress = (ConvertCidrToUint32Array $addressPrefix)[1]
If($endIPAddress -gt $startIPAddress)
{
If ($endIPAddress -gt $startIPAddress) {
$startIPAddress = $endIPAddress
}
}
@@ -156,22 +166,20 @@ function CalculateNextAddressPrefix
return $addressPrefixResult
}
function CalculateVpnClientAddressPoolPrefix
{
function CalculateVpnClientAddressPoolPrefix {
param($gatewaySubnetPrefix)
Write-Host "Calculating VPN client address pool prefix."
If($gatewaySubnetPrefix.StartsWith("10."))
{
If ($gatewaySubnetPrefix.StartsWith("10.")) {
return "192.168.0.0/24"
}
else
{
else {
return "172.16.0.0/24"
}
}
VerifyPSVersion
EnsureAzModule
EnsureLogin
SelectSubscriptionId -subscriptionId $subscriptionId
@@ -179,34 +187,36 @@ $virtualNetwork = LoadVirtualNetwork -resourceGroupName $resourceGroupName -virt
$subnets = $virtualNetwork.Subnets.Name
If($false -eq $subnets.Contains($managementSubnetName))
{
If ($false -eq $subnets.Contains($managementSubnetName)) {
Write-Host "$managementSubnetName is not one of the subnets in $subnets" -ForegroundColor Yellow
Write-Host "Creating subnet $managementSubnetName ($managementSubnetPrefix) in the VNet..." -ForegroundColor Green
$managementSubnetPrefix = CalculateNextAddressPrefix $virtualNetwork 28
Write-Host "Creating subnet $managementSubnetName ($managementSubnetPrefix) in the virtual network ..." -ForegroundColor Green
$virtualNetwork.AddressSpace.AddressPrefixes.Add($managementSubnetPrefix)
Add-AzureRmVirtualNetworkSubnetConfig -Name $managementSubnetName -VirtualNetwork $virtualNetwork -AddressPrefix $managementSubnetPrefix | Out-Null
Add-AzVirtualNetworkSubnetConfig -Name $managementSubnetName -VirtualNetwork $virtualNetwork -AddressPrefix $managementSubnetPrefix | Out-Null
SetVirtualNetwork $virtualNetwork
Write-Host "Added subnet $managementSubnetName into VNet." -ForegroundColor Green
} else {
Write-Host "The subnet $managementSubnetName exists in the VNet." -ForegroundColor Green
Write-Host "Added subnet $managementSubnetName into virtual network." -ForegroundColor Green
}
else {
Write-Host "The subnet $managementSubnetName exists in the virtual network." -ForegroundColor Green
}
Write-Host
# Start the deployment
Write-Host "Starting deployment..."
Write-Host "Deployment will take about 20m." -ForegroundColor Yellow
$templateParameters = @{
virtualNetworkName = $virtualNetworkName
managementSubnetName = $managementSubnetName
virtualMachineName = $virtualMachineName
administratorLogin = $administratorLogin
administratorLoginPassword = $administratorLoginPassword
location = $virtualNetwork.Location
virtualNetworkName = $virtualNetworkName
managementSubnetName = $managementSubnetName
virtualMachineName = $virtualMachineName
administratorLogin = $administratorLogin
administratorLoginPassword = $administratorLoginPassword
}
New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateUri ($scriptUrlBase+'/azuredeploy.json?t='+ [DateTime]::Now.Ticks) -TemplateParameterObject $templateParameters
New-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateUri ($scriptUrlBase + '/azuredeploy.json?t=' + [DateTime]::Now.Ticks) -TemplateParameterObject $templateParameters
Write-Host "Deployment completed."
@@ -29,8 +29,11 @@ To run this sample, you need the following prerequisites.
**Software prerequisites:**
1. PowerShell 5.1
2. Azure PowerShell 5.4.2 or higher
1. PowerShell 5.1 or PowerShell Core 6.0
2. Azure PowerShell Az module
**Linux prerequisites**
1. strongSwan
**Azure prerequisites:**
@@ -40,7 +43,7 @@ To run this sample, you need the following prerequisites.
## Run this sample
Run the script below from Windows PowerShell
Run the script below from PowerShell
```powershell
@@ -1,56 +1,82 @@
$parameters = $args[0]
$scriptUrlBase = $args[1]
$subscriptionId = $parameters['subscriptionId']
$resourceGroupName = $parameters['resourceGroupName']
$virtualNetworkName = $parameters['virtualNetworkName']
$certificateNamePrefix = $parameters['certificateNamePrefix']
$force = $parameters['force']
$clientCertificatePassword = $parameters['clientCertificatePassword'] #used only when certificates are created using openssl
$scriptUrlBase = $args[1]
if ($clientCertificatePassword -eq '' -or ($null -eq $clientCertificatePassword)) {
$clientCertificatePassword = 'S0m3Str0nGP@ssw0rd'
}
function VerifyPSVersion
{
Write-Host "Verifying PowerShell version, must be 5.0 or higher."
if($PSVersionTable.PSVersion.Major -ge 5)
{
Write-Host "PowerShell version verified." -ForegroundColor Green
function VerifyPSVersion {
Write-Host "Verifying PowerShell version."
if ($PSVersionTable.PSEdition -eq "Desktop") {
if (($PSVersionTable.PSVersion.Major -ge 6) -or
(($PSVersionTable.PSVersion.Major -eq 5) -and ($PSVersionTable.PSVersion.Minor -ge 1))) {
Write-Host "PowerShell version verified." -ForegroundColor Green
}
else {
Write-Host "You need to install PowerShell version 5.1 or heigher." -ForegroundColor Red
Break;
}
}
else
{
Write-Host "You need to install PowerShell version 5.0 or heigher." -ForegroundColor Red
Break;
else {
if ($PSVersionTable.PSVersion.Major -ge 6) {
Write-Host "PowerShell version verified." -ForegroundColor Green
}
else {
Write-Host "You need to install PowerShell version 6.0 or heigher." -ForegroundColor Red
Break;
}
}
}
function Ensure-Login ()
{
$context = Get-AzureRmContext
If($context.Subscription -eq $null)
{
Write-Host "Loging in ..."
If((Login-AzureRmAccount -ErrorAction SilentlyContinue -ErrorVariable Errors) -eq $null)
{
Write-Host ("Login failed: {0}" -f $Errors[0].Exception.Message) -ForegroundColor Red
function EnsureAzModule {
Write-Host "Checking if Az module is imported."
$module = Get-Module Az
If ($null -eq $module) {
try {
Import-Module Az -ErrorAction Stop
Write-Host "Module Az imported." -ForegroundColor Green
}
catch {
Install-Module Az -AllowClobber
Write-Host "Module Az installed." -ForegroundColor Green
}
}
else {
Write-Host "Module Az imported." -ForegroundColor Green
}
}
function EnsureLogin () {
$context = Get-AzContext
If ($null -eq $context.Subscription) {
Write-Host "Sign-in..."
If ($null -eq (Connect-AzAccount -ErrorAction SilentlyContinue -ErrorVariable Errors)) {
Write-Host ("Sign-in failed: {0}" -f $Errors[0].Exception.Message) -ForegroundColor Red
Break
}
}
Write-Host "User logedin." -ForegroundColor Green
Write-Host "Sign-in successful." -ForegroundColor Green
}
function Select-SubscriptionId {
function SelectSubscriptionId {
param (
$subscriptionId
)
Write-Host "Selecting subscription '$subscriptionId'."
$context = Get-AzureRmContext
If($context.Subscription.Id -ne $subscriptionId)
{
Try
{
Select-AzureRmSubscription -SubscriptionId $subscriptionId -ErrorAction Stop | Out-null
Write-Host "Selecting subscription '$subscriptionId'..."
$context = Get-AzContext
If ($context.Subscription.Id -ne $subscriptionId) {
Try {
$currentSubscriptionId = $context.Subscription.Id
Write-Host "Switching subscription $currentSubscriptionId to '$subscriptionId'." -ForegroundColor Green
Select-AzSubscription -SubscriptionId $subscriptionId -ErrorAction Stop | Out-null
}
Catch
{
Catch {
Write-Host "Subscription selection failed: $_" -ForegroundColor Red
Break
}
@@ -58,78 +84,57 @@ function Select-SubscriptionId {
Write-Host "Subscription selected." -ForegroundColor Green
}
function Load-VirtualNetwork {
function LoadVirtualNetwork {
param (
$resourceGroupName,
$virtualNetworkName
)
Write-Host("Loading virtual network '{0}' in resource group '{1}'." -f $virtualNetworkName, $resourceGroupName)
$virtualNetwork = Get-AzureRmVirtualNetwork -ResourceGroupName $resourceGroupName -Name $virtualNetworkName -ErrorAction SilentlyContinue
If($virtualNetwork.Id -ne $null)
{
Write-Host "Virtual network loaded." -ForegroundColor Green
return $virtualNetwork
Write-Host("Loading virtual network '{0}' in resource group '{1}'." -f $virtualNetworkName, $resourceGroupName)
$virtualNetwork = Get-AzVirtualNetwork -ResourceGroupName $resourceGroupName -Name $virtualNetworkName -ErrorAction SilentlyContinue
$id = $virtualNetwork.Id
If ($null -ne $id) {
Write-Host "Virtual network with id $id is loaded." -ForegroundColor Green
If ($virtualNetwork.VirtualNetworkPeerings.Count -gt 0) {
Write-Host "Virtual network is loaded, but it should not have peerings." -ForegroundColor Red
}
else
{
Write-Host "Virtual network not found." -ForegroundColor Red
Break
}
}
function Load-ResourceGroup {
param (
$resourceGroupName
)
Write-Host("Loading resource group '{0}'." -f $resourceGroupName)
$resourceGroup = Get-AzureRmResourceGroup -Name $resourceGroupName
If($resourceGroup.ResourceId -ne $null)
{
Write-Host "Resource group loaded." -ForegroundColor Green
return $resourceGroup
return $virtualNetwork
}
else
{
Write-Host "Resource group not found." -ForegroundColor Red
else {
Write-Host "Virtual network $virtualNetworkName cannot be found." -ForegroundColor Red
Break
}
}
function Set-VirtualNetwork
{
function SetVirtualNetwork {
param($virtualNetwork)
Write-Host "Applying changes to the virtual network."
Try
{
Set-AzureRmVirtualNetwork -VirtualNetwork $virtualNetwork -ErrorAction Stop | Out-Null
Try {
Set-AzVirtualNetwork -VirtualNetwork $virtualNetwork -ErrorAction Stop | Out-Null
}
Catch
{
Write-Host "Failed: $_" -ForegroundColor Red
Catch {
Write-Host "Failed to configure Virtual Network: $_" -ForegroundColor Red
}
}
function ConvertCidrToUint32Array
{
function ConvertCidrToUint32Array {
param($cidrRange)
$cidrRangeParts = $cidrRange.Split(@(".","/"))
$ipnum = ([Convert]::ToUInt32($cidrRangeParts[0]) -shl 24) -bor `
([Convert]::ToUInt32($cidrRangeParts[1]) -shl 16) -bor `
([Convert]::ToUInt32($cidrRangeParts[2]) -shl 8) -bor `
[Convert]::ToUInt32($cidrRangeParts[3])
$cidrRangeParts = $cidrRange.Split("/")
$ipParts = $cidrRangeParts[0].Split(".")
$ipnum = ([Convert]::ToUInt32($ipParts[0]) -shl 24) -bor `
([Convert]::ToUInt32($ipParts[1]) -shl 16) -bor `
([Convert]::ToUInt32($ipParts[2]) -shl 8) -bor `
[Convert]::ToUInt32($ipParts[3])
$maskbits = [System.Convert]::ToInt32($cidrRangeParts[4])
$maskbits = [System.Convert]::ToInt32($cidrRangeParts[1])
$mask = 0xffffffff
$mask = $mask -shl (32 -$maskbits)
$mask = $mask -shl (32 - $maskbits)
$ipstart = $ipnum -band $mask
$ipend = $ipnum -bor ($mask -bxor 0xffffffff)
return @($ipstart, $ipend)
}
function ConvertUInt32ToIPAddress
{
function ConvertUInt32ToIPAddress {
param($uint32IP)
$v1 = $uint32IP -band 0xff
$v2 = ($uint32IP -shr 8) -band 0xff
@@ -138,80 +143,126 @@ function ConvertUInt32ToIPAddress
return "$v4.$v3.$v2.$v1"
}
function CalculateNextAddressPrefix
{
function CalculateNextAddressPrefix {
param($virtualNetwork, $prefixLength)
Write-Host "Calculating address prefix."
Write-Host "Calculating address prefix with length $prefixLength..."
$startIPAddress = 0
ForEach($addressPrefix in $virtualNetwork.AddressSpace.AddressPrefixes)
{
ForEach ($addressPrefix in $virtualNetwork.AddressSpace.AddressPrefixes) {
$endIPAddress = (ConvertCidrToUint32Array $addressPrefix)[1]
If($endIPAddress -gt $startIPAddress)
{
If ($endIPAddress -gt $startIPAddress) {
$startIPAddress = $endIPAddress
}
}
$startIPAddress += 1
return (ConvertUInt32ToIPAddress $startIPAddress) + "/" + $prefixLength
$addressPrefixResult = (ConvertUInt32ToIPAddress $startIPAddress) + "/" + $prefixLength
Write-Host "Using address prefix $addressPrefixResult." -ForegroundColor Green
return $addressPrefixResult
}
function CalculateVpnClientAddressPoolPrefix
{
function CalculateVpnClientAddressPoolPrefix {
param($gatewaySubnetPrefix)
Write-Host "Calculating VPN client address pool prefix."
If($gatewaySubnetPrefix.StartsWith("10."))
{
If ($gatewaySubnetPrefix.StartsWith("10.")) {
return "192.168.0.0/24"
}
else
{
else {
return "172.16.0.0/24"
}
}
function CreateCerificateWindows() {
$certificate = New-SelfSignedCertificate -Type Custom -KeySpec Signature `
-Subject ("CN=$certificateNamePrefix" + "P2SRoot") -KeyExportPolicy Exportable `
-HashAlgorithm sha256 -KeyLength 2048 `
-CertStoreLocation "Cert:\CurrentUser\My" -KeyUsageProperty Sign -KeyUsage CertSign
$certificateThumbprint = $certificate.Thumbprint
New-SelfSignedCertificate -Type Custom -DnsName ($certificateNamePrefix + "P2SChild") -KeySpec Signature `
-Subject ("CN=$certificateNamePrefix" + "P2SChild") -KeyExportPolicy Exportable `
-HashAlgorithm sha256 -KeyLength 2048 `
-CertStoreLocation "Cert:\CurrentUser\My" `
-Signer $certificate -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.2") | Out-null
[Convert]::ToBase64String((Get-Item cert:\currentuser\my\$certificateThumbprint).RawData)
}
function CreateCerificateOpenSsl() {
$dn = "CN=$certificateNamePrefix" + "P2SRoot"
ipsec pki --gen --outform pem > caKey.pem
ipsec pki --self --in caKey.pem --dn $dn --ca --outform pem > caCert.pem
$dn = $certificateNamePrefix + "P2SChild"
ipsec pki --gen --outform pem > "$($dn)Key.pem"
ipsec pki --pub --in "$($dn)Key.pem" --outform pem > "$($dn)PubKey.pem"
ipsec pki --issue --in "$($dn)PubKey.pem" --cacert caCert.pem --cakey caKey.pem --dn "CN=$($dn)" --san $dn --flag clientAuth --outform pem > "$($dn)Cert.pem"
openssl pkcs12 -in "$($dn)Cert.pem" -inkey "$($dn)Key.pem" -certfile caCert.pem -export -out "$($dn).p12" -password "pass:$($clientCertificatePassword)"
#openssl pkcs12 -in "$($dn).p12" -password "pass:$($clientCertificatePassword)" -nocerts -out "$($dn)PrivateKey.pem" -nodes
#openssl pkcs12 -in "$($dn).p12" -password "pass:$($clientCertificatePassword)" -nokeys -out "$($dn)PublicCert.pem" -nodes
$publicRootCertData = openssl x509 -in caCert.pem -outform pem
$publicRootCertData = $publicRootCertData -replace "-----BEGIN CERTIFICATE-----", ""
$publicRootCertData = $publicRootCertData -replace "-----END CERTIFICATE-----", ""
[string]::Join("", $publicRootCertData.Split())
}
function CreateCertificate() {
Write-Host "Creating certificate."
if ($PSVersionTable.PSEdition -eq "Desktop") {
return CreateCerificateWindows
}
else {
return CreateCerificateOpenSsl
}
}
VerifyPSVersion
Ensure-Login
Select-SubscriptionId -subscriptionId $subscriptionId
EnsureAzModule
EnsureLogin
SelectSubscriptionId -subscriptionId $subscriptionId
$virtualNetwork = Load-VirtualNetwork -resourceGroupName $resourceGroupName -virtualNetworkName $virtualNetworkName
$virtualNetwork = LoadVirtualNetwork -resourceGroupName $resourceGroupName -virtualNetworkName $virtualNetworkName
$resourceGroup = Get-AzureRmResourceGroup -Name $resourceGroupName
$subnets = $virtualNetwork.Subnets.Name
$certificate = New-SelfSignedCertificate -Type Custom -KeySpec Signature `
-Subject ("CN=$certificateNamePrefix"+"P2SRoot") -KeyExportPolicy Exportable `
-HashAlgorithm sha256 -KeyLength 2048 `
-CertStoreLocation "Cert:\CurrentUser\My" -KeyUsageProperty Sign -KeyUsage CertSign
$gatewaySubnetName = "GatewaySubnet"
$certificateThumbprint = $certificate.Thumbprint
If ($false -eq $subnets.Contains($gatewaySubnetName)) {
Write-Host "$gatewaySubnetName is not one of the subnets in $subnets" -ForegroundColor Yellow
$gatewaySubnetPrefix = CalculateNextAddressPrefix $virtualNetwork 28
Write-Host "Creating subnet $gatewaySubnetName ($gatewaySubnetPrefix) in the virtual network ..." -ForegroundColor Green
New-SelfSignedCertificate -Type Custom -DnsName ($certificateNamePrefix+"P2SChild") -KeySpec Signature `
-Subject ("CN=$certificateNamePrefix"+"P2SChild") -KeyExportPolicy Exportable `
-HashAlgorithm sha256 -KeyLength 2048 `
-CertStoreLocation "Cert:\CurrentUser\My" `
-Signer $certificate -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.2") | Out-null
$virtualNetwork.AddressSpace.AddressPrefixes.Add($gatewaySubnetPrefix)
Add-AzVirtualNetworkSubnetConfig -Name $gatewaySubnetName -VirtualNetwork $virtualNetwork -AddressPrefix $gatewaySubnetPrefix | Out-Null
$publicRootCertData = [Convert]::ToBase64String((Get-Item cert:\currentuser\my\$certificateThumbprint).RawData)
$gatewaySubnetPrefix = CalculateNextAddressPrefix $virtualNetwork 28
SetVirtualNetwork $virtualNetwork
Write-Host "Added subnet $gatewaySubnetName into virtual network." -ForegroundColor Green
}
else {
Write-Host "The subnet $gatewaySubnetName exists in the virtual network." -ForegroundColor Green
$gatewaySubnet = Get-AzVirtualNetworkSubnetConfig -Name $gatewaySubnetName -VirtualNetwork $virtualNetwork
$gatewaySubnetPrefix = $gatewaySubnet.AddressPrefix[0]
}
$vpnClientAddressPoolPrefix = CalculateVpnClientAddressPoolPrefix $gatewaySubnetPrefix
$virtualNetwork.AddressSpace.AddressPrefixes.Add($gatewaySubnetPrefix)
Add-AzureRmVirtualNetworkSubnetConfig -Name GatewaySubnet -VirtualNetwork $virtualNetwork -AddressPrefix $gatewaySubnetPrefix | Out-Null
Set-VirtualNetwork $virtualNetwork
$publicRootCertData = CreateCertificate
Write-Host
# Start the deployment
Write-Host "Starting deployment..."
Write-Host "Deployment will take about 1h." -ForegroundColor Yellow
$templateParameters = @{
virtualNetworkName = $virtualNetworkName
gatewaySubnetPrefix = $gatewaySubnetPrefix
vpnClientAddressPoolPrefix = $vpnClientAddressPoolPrefix
publicRootCertData = $publicRootCertData
}
location = $virtualNetwork.Location
virtualNetworkName = $virtualNetworkName
gatewaySubnetPrefix = $gatewaySubnetPrefix
vpnClientAddressPoolPrefix = $vpnClientAddressPoolPrefix
publicRootCertData = $publicRootCertData
}
New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateUri ($scriptUrlBase+'/azuredeploy.json?t='+ [DateTime]::Now.Ticks) -TemplateParameterObject $templateParameters
New-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateUri ($scriptUrlBase + '/azuredeploy.json?t=' + [DateTime]::Now.Ticks) -TemplateParameterObject $templateParameters
Write-Host "Deployment completed."
@@ -1,217 +0,0 @@
$parameters = $args[0]
$subscriptionId = $parameters['subscriptionId']
$resourceGroupName = $parameters['resourceGroupName']
$virtualNetworkName = $parameters['virtualNetworkName']
$certificateNamePrefix = $parameters['certificateNamePrefix']
$force = $parameters['force']
$scriptUrlBase = $args[1]
function VerifyPSVersion
{
Write-Host "Verifying PowerShell version, must be 5.0 or higher."
if($PSVersionTable.PSVersion.Major -ge 5)
{
Write-Host "PowerShell version verified." -ForegroundColor Green
}
else
{
Write-Host "You need to install PowerShell version 5.0 or heigher." -ForegroundColor Red
Break;
}
}
function Ensure-Login ()
{
$context = Get-AzContext
If($context.Subscription -eq $null)
{
Write-Host "Loging in ..."
If((Connect-AzAccount -ErrorAction SilentlyContinue -ErrorVariable Errors) -eq $null)
{
Write-Host ("Login failed: {0}" -f $Errors[0].Exception.Message) -ForegroundColor Red
Break
}
}
Write-Host "User logedin." -ForegroundColor Green
}
function Select-SubscriptionId {
param (
$subscriptionId
)
Write-Host "Selecting subscription '$subscriptionId'."
$context = Get-AzContext
If($context.Subscription.Id -ne $subscriptionId)
{
Try
{
Select-AzSubscription -SubscriptionId $subscriptionId -ErrorAction Stop | Out-null
}
Catch
{
Write-Host "Subscription selection failed: $_" -ForegroundColor Red
Break
}
}
Write-Host "Subscription selected." -ForegroundColor Green
}
function Load-VirtualNetwork {
param (
$resourceGroupName,
$virtualNetworkName
)
Write-Host("Loading virtual network '{0}' in resource group '{1}'." -f $virtualNetworkName, $resourceGroupName)
$virtualNetwork = Get-AzVirtualNetwork -ResourceGroupName $resourceGroupName -Name $virtualNetworkName -ErrorAction SilentlyContinue
If($virtualNetwork.Id -ne $null)
{
Write-Host "Virtual network loaded." -ForegroundColor Green
return $virtualNetwork
}
else
{
Write-Host "Virtual network not found." -ForegroundColor Red
Break
}
}
function Load-ResourceGroup {
param (
$resourceGroupName
)
Write-Host("Loading resource group '{0}'." -f $resourceGroupName)
$resourceGroup = Get-AzResourceGroup -Name $resourceGroupName
If($resourceGroup.ResourceId -ne $null)
{
Write-Host "Resource group loaded." -ForegroundColor Green
return $resourceGroup
}
else
{
Write-Host "Resource group not found." -ForegroundColor Red
Break
}
}
function Set-VirtualNetwork
{
param($virtualNetwork)
Write-Host "Applying changes to the virtual network."
Try
{
Set-AzVirtualNetwork -VirtualNetwork $virtualNetwork -ErrorAction Stop | Out-Null
}
Catch
{
Write-Host "Failed: $_" -ForegroundColor Red
}
}
function ConvertCidrToUint32Array
{
param($cidrRange)
$cidrRangeParts = $cidrRange.Split(@(".","/"))
$ipnum = ([Convert]::ToUInt32($cidrRangeParts[0]) -shl 24) -bor `
([Convert]::ToUInt32($cidrRangeParts[1]) -shl 16) -bor `
([Convert]::ToUInt32($cidrRangeParts[2]) -shl 8) -bor `
[Convert]::ToUInt32($cidrRangeParts[3])
$maskbits = [System.Convert]::ToInt32($cidrRangeParts[4])
$mask = 0xffffffff
$mask = $mask -shl (32 -$maskbits)
$ipstart = $ipnum -band $mask
$ipend = $ipnum -bor ($mask -bxor 0xffffffff)
return @($ipstart, $ipend)
}
function ConvertUInt32ToIPAddress
{
param($uint32IP)
$v1 = $uint32IP -band 0xff
$v2 = ($uint32IP -shr 8) -band 0xff
$v3 = ($uint32IP -shr 16) -band 0xff
$v4 = ($uint32IP -shr 24)
return "$v4.$v3.$v2.$v1"
}
function CalculateNextAddressPrefix
{
param($virtualNetwork, $prefixLength)
Write-Host "Calculating address prefix."
$startIPAddress = 0
ForEach($addressPrefix in $virtualNetwork.AddressSpace.AddressPrefixes)
{
$endIPAddress = (ConvertCidrToUint32Array $addressPrefix)[1]
If($endIPAddress -gt $startIPAddress)
{
$startIPAddress = $endIPAddress
}
}
$startIPAddress += 1
return (ConvertUInt32ToIPAddress $startIPAddress) + "/" + $prefixLength
}
function CalculateVpnClientAddressPoolPrefix
{
param($gatewaySubnetPrefix)
Write-Host "Calculating VPN client address pool prefix."
If($gatewaySubnetPrefix.StartsWith("10."))
{
return "192.168.0.0/24"
}
else
{
return "172.16.0.0/24"
}
}
VerifyPSVersion
Ensure-Login
Select-SubscriptionId -subscriptionId $subscriptionId
$virtualNetwork = Load-VirtualNetwork -resourceGroupName $resourceGroupName -virtualNetworkName $virtualNetworkName
$resourceGroup = Get-AzResourceGroup -Name $resourceGroupName
$certificate = New-SelfSignedCertificate -Type Custom -KeySpec Signature `
-Subject ("CN=$certificateNamePrefix"+"P2SRoot") -KeyExportPolicy Exportable `
-HashAlgorithm sha256 -KeyLength 2048 `
-CertStoreLocation "Cert:\CurrentUser\My" -KeyUsageProperty Sign -KeyUsage CertSign
$certificateThumbprint = $certificate.Thumbprint
New-SelfSignedCertificate -Type Custom -DnsName ($certificateNamePrefix+"P2SChild") -KeySpec Signature `
-Subject ("CN=$certificateNamePrefix"+"P2SChild") -KeyExportPolicy Exportable `
-HashAlgorithm sha256 -KeyLength 2048 `
-CertStoreLocation "Cert:\CurrentUser\My" `
-Signer $certificate -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.2") | Out-null
$publicRootCertData = [Convert]::ToBase64String((Get-Item cert:\currentuser\my\$certificateThumbprint).RawData)
$gatewaySubnetPrefix = CalculateNextAddressPrefix $virtualNetwork 28
$vpnClientAddressPoolPrefix = CalculateVpnClientAddressPoolPrefix $gatewaySubnetPrefix
$virtualNetwork.AddressSpace.AddressPrefixes.Add($gatewaySubnetPrefix)
Add-AzVirtualNetworkSubnetConfig -Name GatewaySubnet -VirtualNetwork $virtualNetwork -AddressPrefix $gatewaySubnetPrefix | Out-Null
Set-VirtualNetwork $virtualNetwork
Write-Host
# Start the deployment
Write-Host "Starting deployment..."
$templateParameters = @{
virtualNetworkName = $virtualNetworkName
gatewaySubnetPrefix = $gatewaySubnetPrefix
vpnClientAddressPoolPrefix = $vpnClientAddressPoolPrefix
publicRootCertData = $publicRootCertData
}
New-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateUri ($scriptUrlBase+'/azuredeploy.json?t='+ [DateTime]::Now.Ticks) -TemplateParameterObject $templateParameters
@@ -37,7 +37,6 @@
"variables": {
"gatewayPublicIpAddressName": "[concat('GatewayIP-', uniqueString(resourceGroup().id))]",
"gatewayName": "[concat('Gateway-', uniqueString(resourceGroup().id))]",
"gatewaySku": "Basic",
"gatewaySubnetName": "GatewaySubnet",
"clientRootCertName": "RootCert"
},
@@ -46,7 +45,7 @@
"apiVersion": "2017-10-01",
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('gatewayPublicIpAddressName')]",
"location": "[resourceGroup().location]",
"location": "[parameters('location')]",
"properties": {
"publicIPAllocationMethod": "Dynamic"
}
@@ -55,7 +54,7 @@
"apiVersion": "2017-10-01",
"type": "Microsoft.Network/virtualNetworkGateways",
"name": "[variables('gatewayName')]",
"location": "[resourceGroup().location]",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('gatewayPublicIpAddressName'))]"
],
@@ -75,8 +74,8 @@
}
],
"sku": {
"name": "[variables('gatewaySku')]",
"tier": "[variables('gatewaySku')]"
"name": "Standard",
"tier": "Standard"
},
"gatewayType": "Vpn",
"vpnType": "RouteBased",
@@ -87,6 +86,10 @@
"[parameters('vpnClientAddressPoolPrefix')]"
]
},
"vpnClientProtocols": [
"IkeV2",
"SSTP"
],
"vpnClientRootCertificates": [
{
"name": "[variables('clientRootCertName')]",
@@ -99,4 +102,4 @@
}
}
]
}
}
@@ -0,0 +1,48 @@
declare @source xml = '<place source XML result here>';
declare @target xml = '<place target XML result here>';
with
src as(
select property = x.v.value('name[1]', 'nvarchar(300)'),
value = x.v.value('value[1]', 'nvarchar(300)')
from @source.nodes('//row') x(v)
UNION ALL
select property = 'DB-CONFIG:'+y.v.value('local-name(.)', 'nvarchar(300)'),
value = y.v.value('.[1]', 'nvarchar(300)')
from @source.nodes('//db') x(v)
cross apply x.v.nodes('*') y(v)
UNION ALL
select property = 'TEMPDB:'+y.v.value('local-name(.)', 'nvarchar(300)'),
value = y.v.value('.[1]', 'nvarchar(300)')
from @source.nodes('//tempdb') x(v)
cross apply x.v.nodes('*') y(v)
),
tgt as(
select property = x.v.value('name[1]', 'nvarchar(300)'),
value = x.v.value('value[1]', 'nvarchar(300)')
from @target.nodes('//row') x(v)
UNION ALL
select property = 'DB-CONFIG:'+y.v.value('local-name(.)', 'nvarchar(300)'),
value = y.v.value('.[1]', 'nvarchar(300)')
from @target.nodes('//db') x(v)
cross apply x.v.nodes('*') y(v)
UNION ALL
select property = 'TEMPDB:'+y.v.value('local-name(.)', 'nvarchar(300)'),
value = y.v.value('.[1]', 'nvarchar(300)')
from @target.nodes('//tempdb') x(v)
cross apply x.v.nodes('*') y(v)
),
diff as (
select property = isnull(src.property, tgt.property),
source = src.value, target = tgt.value,
is_missing = (case when src.value is null or tgt.value is null then 1 else 0 end)
from src full outer join tgt on src.property = tgt.property
where (src.value <> tgt.value
or src.value is null and tgt.value is not null
or src.value is not null and tgt.value is null)
)
select *
from diff
where is_missing = 0 -- comment-out this line to compare missing properties.
order by property
@@ -0,0 +1,42 @@
declare @db_name sysname = 'master'
begin
declare @result NVARCHAR(MAX);
set @result = (select compatibility_level, recovery_model_desc, snapshot_isolation_state_desc, is_read_committed_snapshot_on,
is_auto_update_stats_on, is_auto_update_stats_async_on, delayed_durability_desc,
is_encrypted, is_auto_create_stats_incremental_on, is_arithabort_on, is_ansi_warnings_on, is_parameterization_forced
from sys.databases
where name = @db_name
for xml raw('db'), elements);
set @result += (select compatibility_level, snapshot_isolation_state_desc, is_read_committed_snapshot_on,
is_auto_update_stats_on, is_auto_update_stats_async_on, delayed_durability_desc,
is_encrypted, is_auto_create_stats_incremental_on, is_arithabort_on, is_ansi_warnings_on, is_parameterization_forced,
number_of_files = (select count(*) from master.sys.master_files where database_id = db_id('tempdb'))
from sys.databases
where name = 'tempdb'
for xml raw('tempdb'), elements);
set @result += (
select name = CONCAT('DB-CONFIG:',name), value
from sys.database_scoped_configurations
for xml raw, elements );
declare @tf table (TraceFlag smallint, status bit,global bit, session bit)
insert into @tf execute('DBCC TRACESTATUS(-1)');
set @result += (
select name=CONCAT('TF:',TraceFlag), value=status from @tf
where global=1 and session=0
for xml raw, elements
);
set @result += (
select name = CONCAT('CONFIG:',name), value from sys.configurations
where name in ('cost threshold for parallelism','cursor threshold','fill factor (%)'
,'index create memory (KB)','lightweight pooling'
,'locks','max degree of parallelism','max full-text crawl range','max text repl size (B)'
,'max worker threads','min memory per query (KB)','nested triggers'
,'network packet size (B)','optimize for ad hoc workloads'
,'priority boost','query governor cost limit','query wait (s)','recovery interval (min)'
,'set working set size','user connections')
for xml raw, elements
);
select cast(@result as xml);
end;