mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
resolve conflicts
This commit is contained in:
+443
-439
@@ -1,439 +1,443 @@
|
|||||||
## Ignore Visual Studio temporary files, build results, and
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
## files generated by popular Visual Studio add-ons.
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
|
||||||
# User-specific files
|
# User-specific files
|
||||||
*.suo
|
*.suo
|
||||||
*.user
|
*.user
|
||||||
*.userosscache
|
*.userosscache
|
||||||
*.sln.docstates
|
*.sln.docstates
|
||||||
|
|
||||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
*.userprefs
|
*.userprefs
|
||||||
|
|
||||||
# Build results
|
# Build results
|
||||||
[Dd]ebug/
|
[Dd]ebug/
|
||||||
[Dd]ebugPublic/
|
[Dd]ebugPublic/
|
||||||
[Rr]elease/
|
[Rr]elease/
|
||||||
[Rr]eleases/
|
[Rr]eleases/
|
||||||
x64/
|
x64/
|
||||||
x86/
|
x86/
|
||||||
build/
|
build/
|
||||||
bld/
|
bld/
|
||||||
[Bb]in/
|
[Bb]in/
|
||||||
[Oo]bj/
|
[Oo]bj/
|
||||||
out/
|
out/
|
||||||
|
|
||||||
# Visual Studio 2015 cache/options directory
|
# Visual Studio 2015 cache/options directory
|
||||||
.vs/
|
.vs/
|
||||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||||
#wwwroot/
|
#wwwroot/
|
||||||
|
|
||||||
# MSTest test Results
|
# MSTest test Results
|
||||||
[Tt]est[Rr]esult*/
|
[Tt]est[Rr]esult*/
|
||||||
[Bb]uild[Ll]og.*
|
[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
# NUNIT
|
# NUNIT
|
||||||
*.VisualState.xml
|
*.VisualState.xml
|
||||||
TestResult.xml
|
TestResult.xml
|
||||||
|
|
||||||
# Build Results of an ATL Project
|
# Build Results of an ATL Project
|
||||||
[Dd]ebugPS/
|
[Dd]ebugPS/
|
||||||
[Rr]eleasePS/
|
[Rr]eleasePS/
|
||||||
dlldata.c
|
dlldata.c
|
||||||
|
|
||||||
# Benchmark Results
|
# Benchmark Results
|
||||||
BenchmarkDotNet.Artifacts/
|
BenchmarkDotNet.Artifacts/
|
||||||
|
|
||||||
# .NET Core
|
# .NET Core
|
||||||
project.lock.json
|
project.lock.json
|
||||||
project.fragment.lock.json
|
project.fragment.lock.json
|
||||||
artifacts/
|
artifacts/
|
||||||
**/Properties/launchSettings.json
|
**/Properties/launchSettings.json
|
||||||
# DNX
|
# DNX
|
||||||
project.lock.json
|
project.lock.json
|
||||||
artifacts/
|
artifacts/
|
||||||
|
|
||||||
*_i.c
|
*_i.c
|
||||||
*_p.c
|
*_p.c
|
||||||
*_i.h
|
*_i.h
|
||||||
*.ilk
|
*.ilk
|
||||||
*.meta
|
*.meta
|
||||||
*.obj
|
*.obj
|
||||||
*.pch
|
*.pch
|
||||||
*.pdb
|
*.pdb
|
||||||
*.pgc
|
*.pgc
|
||||||
*.pgd
|
*.pgd
|
||||||
*.rsp
|
*.rsp
|
||||||
*.sbr
|
*.sbr
|
||||||
*.tlb
|
*.tlb
|
||||||
*.tli
|
*.tli
|
||||||
*.tlh
|
*.tlh
|
||||||
*.tmp
|
*.tmp
|
||||||
*.tmp_proj
|
*.tmp_proj
|
||||||
*.log
|
*.log
|
||||||
*.vspscc
|
*.vspscc
|
||||||
*.vssscc
|
*.vssscc
|
||||||
.builds
|
.builds
|
||||||
*.pidb
|
*.pidb
|
||||||
*.svclog
|
*.svclog
|
||||||
*.scc
|
*.scc
|
||||||
|
|
||||||
# Chutzpah Test files
|
# Chutzpah Test files
|
||||||
_Chutzpah*
|
_Chutzpah*
|
||||||
|
|
||||||
# Visual C++ cache files
|
# Visual C++ cache files
|
||||||
ipch/
|
ipch/
|
||||||
*.aps
|
*.aps
|
||||||
*.ncb
|
*.ncb
|
||||||
*.opendb
|
*.opendb
|
||||||
*.opensdf
|
*.opensdf
|
||||||
*.sdf
|
*.sdf
|
||||||
*.cachefile
|
*.cachefile
|
||||||
*.VC.db
|
*.VC.db
|
||||||
*.VC.VC.opendb
|
*.VC.VC.opendb
|
||||||
*.opensdf
|
*.opensdf
|
||||||
*.sdf
|
*.sdf
|
||||||
*.cachefile
|
*.cachefile
|
||||||
|
|
||||||
# Visual Studio profiler
|
# Visual Studio profiler
|
||||||
*.psess
|
*.psess
|
||||||
*.vsp
|
*.vsp
|
||||||
*.vspx
|
*.vspx
|
||||||
*.sap
|
*.sap
|
||||||
|
|
||||||
# Visual Studio Trace Files
|
# Visual Studio Trace Files
|
||||||
*.e2e
|
*.e2e
|
||||||
|
|
||||||
# TFS 2012 Local Workspace
|
# TFS 2012 Local Workspace
|
||||||
$tf/
|
$tf/
|
||||||
|
|
||||||
# Guidance Automation Toolkit
|
# Guidance Automation Toolkit
|
||||||
*.gpState
|
*.gpState
|
||||||
|
|
||||||
# ReSharper is a .NET coding add-in
|
# ReSharper is a .NET coding add-in
|
||||||
_ReSharper*/
|
_ReSharper*/
|
||||||
*.[Rr]e[Ss]harper
|
*.[Rr]e[Ss]harper
|
||||||
*.DotSettings.user
|
*.DotSettings.user
|
||||||
|
|
||||||
# JustCode is a .NET coding add-in
|
# JustCode is a .NET coding add-in
|
||||||
.JustCode
|
.JustCode
|
||||||
|
|
||||||
# TeamCity is a build add-in
|
# TeamCity is a build add-in
|
||||||
_TeamCity*
|
_TeamCity*
|
||||||
|
|
||||||
# DotCover is a Code Coverage Tool
|
# DotCover is a Code Coverage Tool
|
||||||
*.dotCover
|
*.dotCover
|
||||||
|
|
||||||
# AxoCover is a Code Coverage Tool
|
# AxoCover is a Code Coverage Tool
|
||||||
.axoCover/*
|
.axoCover/*
|
||||||
!.axoCover/settings.json
|
!.axoCover/settings.json
|
||||||
|
|
||||||
# Visual Studio code coverage results
|
# Visual Studio code coverage results
|
||||||
*.coverage
|
*.coverage
|
||||||
*.coveragexml
|
*.coveragexml
|
||||||
|
|
||||||
# NCrunch
|
# NCrunch
|
||||||
_NCrunch_*
|
_NCrunch_*
|
||||||
.*crunch*.local.xml
|
.*crunch*.local.xml
|
||||||
nCrunchTemp_*
|
nCrunchTemp_*
|
||||||
|
|
||||||
# MightyMoose
|
# MightyMoose
|
||||||
*.mm.*
|
*.mm.*
|
||||||
AutoTest.Net/
|
AutoTest.Net/
|
||||||
|
|
||||||
# Web workbench (sass)
|
# Web workbench (sass)
|
||||||
.sass-cache/
|
.sass-cache/
|
||||||
|
|
||||||
# Installshield output folder
|
# Installshield output folder
|
||||||
[Ee]xpress/
|
[Ee]xpress/
|
||||||
|
|
||||||
# DocProject is a documentation generator add-in
|
# DocProject is a documentation generator add-in
|
||||||
DocProject/buildhelp/
|
DocProject/buildhelp/
|
||||||
DocProject/Help/*.HxT
|
DocProject/Help/*.HxT
|
||||||
DocProject/Help/*.HxC
|
DocProject/Help/*.HxC
|
||||||
DocProject/Help/*.hhc
|
DocProject/Help/*.hhc
|
||||||
DocProject/Help/*.hhk
|
DocProject/Help/*.hhk
|
||||||
DocProject/Help/*.hhp
|
DocProject/Help/*.hhp
|
||||||
DocProject/Help/Html2
|
DocProject/Help/Html2
|
||||||
DocProject/Help/html
|
DocProject/Help/html
|
||||||
|
|
||||||
# Click-Once directory
|
# Click-Once directory
|
||||||
# publish/
|
# publish/
|
||||||
|
|
||||||
# Publish Web Output
|
# Publish Web Output
|
||||||
*.azurePubxml
|
*.azurePubxml
|
||||||
# TODO: Comment the next line if you want to checkin your web deploy settings
|
# TODO: Comment the next line if you want to checkin your web deploy settings
|
||||||
# but database connection strings (with potential passwords) will be unencrypted
|
# but database connection strings (with potential passwords) will be unencrypted
|
||||||
*.pubxml
|
*.pubxml
|
||||||
*.publishproj
|
*.publishproj
|
||||||
|
|
||||||
# NuGet Packages
|
# NuGet Packages
|
||||||
*.nupkg
|
*.nupkg
|
||||||
# The packages folder can be ignored because of Package Restore
|
# The packages folder can be ignored because of Package Restore
|
||||||
**/packages/*
|
**/packages/*
|
||||||
# except build/, which is used as an MSBuild target.
|
# except build/, which is used as an MSBuild target.
|
||||||
!**/packages/build/
|
!**/packages/build/
|
||||||
# Uncomment if necessary however generally it will be regenerated when needed
|
# Uncomment if necessary however generally it will be regenerated when needed
|
||||||
#!**/packages/repositories.config
|
#!**/packages/repositories.config
|
||||||
|
|
||||||
# Windows Azure Build Output
|
# Windows Azure Build Output
|
||||||
csx/
|
csx/
|
||||||
*.build.csdef
|
*.build.csdef
|
||||||
|
|
||||||
# Windows Store app package directory
|
# Windows Store app package directory
|
||||||
AppPackages/
|
AppPackages/
|
||||||
|
|
||||||
# Visual Studio cache files
|
# Visual Studio cache files
|
||||||
# files ending in .cache can be ignored
|
# files ending in .cache can be ignored
|
||||||
*.[Cc]ache
|
*.[Cc]ache
|
||||||
# but keep track of directories ending in .cache
|
# but keep track of directories ending in .cache
|
||||||
!*.[Cc]ache/
|
!*.[Cc]ache/
|
||||||
|
|
||||||
# Others
|
# Others
|
||||||
ClientBin/
|
ClientBin/
|
||||||
[Ss]tyle[Cc]op.*
|
[Ss]tyle[Cc]op.*
|
||||||
~$*
|
~$*
|
||||||
*~
|
*~
|
||||||
*.dbmdl
|
*.dbmdl
|
||||||
*.dbproj.schemaview
|
*.dbproj.schemaview
|
||||||
*.jfm
|
*.jfm
|
||||||
*.pfx
|
*.pfx
|
||||||
*.publishsettings
|
*.publishsettings
|
||||||
orleans.codegen.cs
|
orleans.codegen.cs
|
||||||
|
|
||||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||||
#bower_components/
|
#bower_components/
|
||||||
|
|
||||||
*.pfx
|
*.pfx
|
||||||
*.publishsettings
|
*.publishsettings
|
||||||
node_modules/
|
node_modules/
|
||||||
orleans.codegen.cs
|
orleans.codegen.cs
|
||||||
|
|
||||||
# RIA/Silverlight projects
|
# RIA/Silverlight projects
|
||||||
Generated_Code/
|
Generated_Code/
|
||||||
|
|
||||||
# Backup & report files from converting an old project file
|
# Backup & report files from converting an old project file
|
||||||
# to a newer Visual Studio version. Backup files are not needed,
|
# to a newer Visual Studio version. Backup files are not needed,
|
||||||
# because we have git ;-)
|
# because we have git ;-)
|
||||||
_UpgradeReport_Files/
|
_UpgradeReport_Files/
|
||||||
Backup*/
|
Backup*/
|
||||||
UpgradeLog*.XML
|
UpgradeLog*.XML
|
||||||
UpgradeLog*.htm
|
UpgradeLog*.htm
|
||||||
|
|
||||||
# SQL Server files
|
# SQL Server files
|
||||||
*.mdf
|
*.mdf
|
||||||
*.ldf
|
*.ldf
|
||||||
*.ndf
|
*.ndf
|
||||||
|
|
||||||
# Business Intelligence projects
|
# Business Intelligence projects
|
||||||
*.rdl.data
|
*.rdl.data
|
||||||
*.bim.layout
|
*.bim.layout
|
||||||
*.bim_*.settings
|
*.bim_*.settings
|
||||||
|
|
||||||
# Microsoft Fakes
|
# Microsoft Fakes
|
||||||
FakesAssemblies/
|
FakesAssemblies/
|
||||||
|
|
||||||
# GhostDoc plugin setting file
|
# GhostDoc plugin setting file
|
||||||
*.GhostDoc.xml
|
*.GhostDoc.xml
|
||||||
|
|
||||||
# Node.js Tools for Visual Studio
|
# Node.js Tools for Visual Studio
|
||||||
.ntvs_analysis.dat
|
.ntvs_analysis.dat
|
||||||
node_modules/
|
node_modules/
|
||||||
|
|
||||||
# Typescript v1 declaration files
|
# Typescript v1 declaration files
|
||||||
typings/
|
typings/
|
||||||
# Node.js Tools for Visual Studio
|
# Node.js Tools for Visual Studio
|
||||||
.ntvs_analysis.dat
|
.ntvs_analysis.dat
|
||||||
|
|
||||||
# Visual Studio 6 build log
|
# Visual Studio 6 build log
|
||||||
*.plg
|
*.plg
|
||||||
|
|
||||||
# Visual Studio 6 workspace options file
|
# Visual Studio 6 workspace options file
|
||||||
*.opt
|
*.opt
|
||||||
|
|
||||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||||
*.vbw
|
*.vbw
|
||||||
|
|
||||||
# Visual Studio LightSwitch build output
|
# Visual Studio LightSwitch build output
|
||||||
**/*.HTMLClient/GeneratedArtifacts
|
**/*.HTMLClient/GeneratedArtifacts
|
||||||
**/*.DesktopClient/GeneratedArtifacts
|
**/*.DesktopClient/GeneratedArtifacts
|
||||||
**/*.DesktopClient/ModelManifest.xml
|
**/*.DesktopClient/ModelManifest.xml
|
||||||
**/*.Server/GeneratedArtifacts
|
**/*.Server/GeneratedArtifacts
|
||||||
**/*.Server/ModelManifest.xml
|
**/*.Server/ModelManifest.xml
|
||||||
_Pvt_Extensions
|
_Pvt_Extensions
|
||||||
|
|
||||||
# Paket dependency manager
|
# Paket dependency manager
|
||||||
.paket/paket.exe
|
.paket/paket.exe
|
||||||
paket-files/
|
paket-files/
|
||||||
|
|
||||||
# FAKE - F# Make
|
# FAKE - F# Make
|
||||||
.fake/
|
.fake/
|
||||||
|
|
||||||
# JetBrains Rider
|
# JetBrains Rider
|
||||||
.idea/
|
.idea/
|
||||||
*.sln.iml
|
*.sln.iml
|
||||||
|
|
||||||
# CodeRush
|
# CodeRush
|
||||||
.cr/
|
.cr/
|
||||||
|
|
||||||
# Python Tools for Visual Studio (PTVS)
|
# Python Tools for Visual Studio (PTVS)
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.pyc
|
*.pyc
|
||||||
|
|
||||||
# Cake - Uncomment if you are using it
|
# Cake - Uncomment if you are using it
|
||||||
# tools/**
|
# tools/**
|
||||||
# !tools/packages.config
|
# !tools/packages.config
|
||||||
|
|
||||||
# Tabs Studio
|
# Tabs Studio
|
||||||
*.tss
|
*.tss
|
||||||
|
|
||||||
# Telerik's JustMock configuration file
|
# Telerik's JustMock configuration file
|
||||||
*.jmconfig
|
*.jmconfig
|
||||||
|
|
||||||
# BizTalk build output
|
# BizTalk build output
|
||||||
*.btp.cs
|
*.btp.cs
|
||||||
*.btm.cs
|
*.btm.cs
|
||||||
*.odx.cs
|
*.odx.cs
|
||||||
*.xsd.cs
|
*.xsd.cs
|
||||||
|
|
||||||
# OpenCover UI analysis results
|
# OpenCover UI analysis results
|
||||||
OpenCover/
|
OpenCover/
|
||||||
|
|
||||||
/build
|
/build
|
||||||
/Build
|
/Build
|
||||||
/deploy
|
/deploy
|
||||||
/package
|
/package
|
||||||
bin/
|
bin/
|
||||||
obj/
|
obj/
|
||||||
sql/
|
sql/
|
||||||
*/obj/debug
|
*/obj/debug
|
||||||
**/Debug
|
**/Debug
|
||||||
#ignore thumbnails created by windows
|
#ignore thumbnails created by windows
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
#Ignore files build by Visual Studio
|
#Ignore files build by Visual Studio
|
||||||
*.obj
|
*.obj
|
||||||
*.pdb
|
*.pdb
|
||||||
*.user
|
*.user
|
||||||
*.aps
|
*.aps
|
||||||
*.pch
|
*.pch
|
||||||
*.docstates
|
*.docstates
|
||||||
*.vspscc
|
*.vspscc
|
||||||
*_i.c
|
*_i.c
|
||||||
*_p.c
|
*_p.c
|
||||||
*.ncb
|
*.ncb
|
||||||
*.suo
|
*.suo
|
||||||
*.tlb
|
*.tlb
|
||||||
*.dbmdl
|
*.dbmdl
|
||||||
*.schemaview
|
*.schemaview
|
||||||
*.tlh
|
*.tlh
|
||||||
*.cache
|
*.cache
|
||||||
*.ilk
|
*.ilk
|
||||||
*.log
|
*.log
|
||||||
[Bb]in
|
[Bb]in
|
||||||
[Dd]ebug*/
|
[Dd]ebug*/
|
||||||
*.lib
|
*.lib
|
||||||
*.sbr
|
*.sbr
|
||||||
obj/
|
obj/
|
||||||
[Rr]elease*/
|
[Rr]elease*/
|
||||||
_ReSharper*/
|
_ReSharper*/
|
||||||
[Tt]est[Rr]esult*
|
[Tt]est[Rr]esult*
|
||||||
*.docstates
|
*.docstates
|
||||||
*.swp
|
*.swp
|
||||||
*.*~
|
*.*~
|
||||||
*.gpState
|
*.gpState
|
||||||
*.ReSharper*
|
*.ReSharper*
|
||||||
*.preflight
|
*.preflight
|
||||||
*.nocommit
|
*.nocommit
|
||||||
#Ignore Recovery Files made by Excel
|
#Ignore Recovery Files made by Excel
|
||||||
~$*.xlsx
|
~$*.xlsx
|
||||||
*.rdl.data
|
*.rdl.data
|
||||||
|
|
||||||
*.jfm
|
*.jfm
|
||||||
|
|
||||||
#======================================================================================
|
#======================================================================================
|
||||||
# The below section could possibly be removed as these should be ignored by the above.
|
# 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
|
samples/in-memory/ticket-reservations/DemoWorkload/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
|
||||||
*.nupkg
|
*.nupkg
|
||||||
samples/in-memory/ticket-reservations/packages/CircularGauge.1.0.0/CreatePackageFile.bat
|
samples/in-memory/ticket-reservations/packages/CircularGauge.1.0.0/CreatePackageFile.bat
|
||||||
*.suo
|
*.suo
|
||||||
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/bin/Debug/PopulateAlwaysEncryptedData.exe
|
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/bin/Debug/PopulateAlwaysEncryptedData.exe
|
||||||
*.pdb
|
*.pdb
|
||||||
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/bin/Debug/PopulateAlwaysEncryptedData.vshost.exe
|
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/bin/Debug/PopulateAlwaysEncryptedData.vshost.exe
|
||||||
*.Cache
|
*.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/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/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
|
samples/databases/wide-world-importers/workload-drivers/vehicle-location-insert/MultithreadedInMemoryTableInsert/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
|
||||||
*.exe
|
*.exe
|
||||||
samples/features/in-memory/iot-smart-grid/ConsoleClient/bin/Release/DataGenerator.dll
|
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/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/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/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/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
|
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/obj/Release/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
|
||||||
*.dll
|
*.dll
|
||||||
samples/features/in-memory/ticket-reservations/DemoWorkload/obj/Release/DemoWorkload.FrmConfig.resources
|
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/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/obj/Debug/PopulateAlwaysEncryptedData.csproj.FileListAbsolute.txt
|
||||||
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/bin/Debug/PopulateAlwaysEncryptedData.vshost.exe.config
|
samples/databases/wide-world-importers/sample-scripts/always-encrypted/PopulateAlwaysEncryptedData/bin/Debug/PopulateAlwaysEncryptedData.vshost.exe.config
|
||||||
*.zip
|
*.zip
|
||||||
samples/features/in-memory/ticket-reservations/packages/CircularGauge.1.0.0/CreatePackageFile.bat
|
samples/features/in-memory/ticket-reservations/packages/CircularGauge.1.0.0/CreatePackageFile.bat
|
||||||
samples/features/in-memory/ticket-reservations/TicketReservations/TicketReservations.dbmdl
|
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/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/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/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/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/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/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/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/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
|
samples/features/in-memory/ticket-reservations/packages/CircularGauge.1.0.0/ReadMe.txt
|
||||||
*.dacpac
|
*.dacpac
|
||||||
samples/features/in-memory/ticket-reservations/TicketReservations/obj/Release/Model.xml
|
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
|
samples/features/in-memory/ticket-reservations/DemoWorkload/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
|
||||||
*.dat
|
*.dat
|
||||||
|
|
||||||
*.user
|
*.user
|
||||||
samples/features/in-memory/ticket-reservations/DemoWorkload/obj/Release/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
|
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/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/bin/Debug/DemoWorkload.vshost.exe.config
|
||||||
samples/features/in-memory/ticket-reservations/DemoWorkload/obj/Release/DemoWorkload.Properties.Resources.resources
|
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/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/ticket-reservations/DemoWorkload/obj/Debug/DemoWorkload.csproj.FileListAbsolute.txt
|
||||||
samples/features/in-memory/iot-smart-grid/Db/obj/Release/Model.xml
|
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/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/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
|
samples/features/in-memory/iot-smart-grid/ConsoleClient/bin/Release/ConsoleClient.exe.config
|
||||||
*.jfm
|
*.jfm
|
||||||
samples/features/in-memory/ticket-reservations/TicketReservations/bin/Release/TicketReservations.publish.sql
|
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/ConsoleClient/bin/Release/ConsoleClient.exe.config
|
||||||
samples/applications/iot-smart-grid/Db/Db.dbmdl
|
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/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/obj/Debug/Model.xml
|
||||||
samples/databases/wide-world-importers/wwi-dw-ssdt/wwi-dw-ssdt/WideWorldImportersDW.dbmdl
|
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/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/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/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/databases/wide-world-importers/wwi-ssasmd/wwi-ssasmd/bin/WWI-SSASMD.asdatabase
|
||||||
samples/applications/iot-smart-grid/Db/obj/Release/Db.sqlproj.FileListAbsolute.txt
|
samples/applications/iot-smart-grid/Db/obj/Release/Db.sqlproj.FileListAbsolute.txt
|
||||||
*.manifest
|
*.manifest
|
||||||
samples/applications/iot-smart-grid/WinFormsClient/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
|
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/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/ConsoleClient/bin/Release/Reports/PowerDashboard.pbix
|
||||||
samples/applications/iot-smart-grid/Db/obj/Release/Model.xml
|
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/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/ConsoleClient/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
|
||||||
samples/applications/iot-smart-grid/WinFormsClient/bin/Release/Client.exe.config
|
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/bin/Release/MultithreadedOrderInsert.exe.config
|
||||||
samples/databases/wide-world-importers/workload-drivers/order-insert/MultithreadedOrderInsert/obj/Debug/MultithreadedInMemoryTableInsert.MultithreadedOrderInsertMain.resources
|
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/PolicyEvaluationErrors.rdl.data
|
||||||
/samples/features/epm-framework/5.0/2Reporting/PolicyReports/PolicyEvaluationErrorDetails.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/PolicyEvaluationDetails.rdl.data
|
||||||
/samples/features/epm-framework/5.0/2Reporting/PolicyReports/PolicyDetails.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/PolicyDashboard.rdl.data
|
||||||
/samples/features/epm-framework/5.0/2Reporting/PolicyReports/bin/Debug
|
/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/PolicyDashboard - Backup.rdl
|
||||||
/samples/features/epm-framework/5.0/2Reporting/PolicyReports/PolicyDashboardFiltered.rdl.data
|
/samples/features/epm-framework/5.0/2Reporting/PolicyReports/PolicyDashboardFiltered.rdl.data
|
||||||
samples/features/sql-management-objects/src/out/CodeCoverage/CodeCoverage.config
|
samples/features/sql-management-objects/src/out/CodeCoverage/CodeCoverage.config
|
||||||
|
|
||||||
|
# Certificates
|
||||||
|
*.pem
|
||||||
|
*.p12
|
||||||
|
|||||||
+2
-2
@@ -3,7 +3,7 @@
|
|||||||
-- bigger - so you can see more impactful
|
-- bigger - so you can see more impactful
|
||||||
-- Intelligent QP demonstrations (aka.ms/iqp)
|
-- Intelligent QP demonstrations (aka.ms/iqp)
|
||||||
--
|
--
|
||||||
-- Script last updated 10/02/2018
|
-- Script last updated 05/03/2019
|
||||||
--
|
--
|
||||||
-- Database backup source: aka.ms/wwibak
|
-- Database backup source: aka.ms/wwibak
|
||||||
--
|
--
|
||||||
@@ -100,4 +100,4 @@ GO
|
|||||||
|
|
||||||
UPDATE Fact.OrderHistoryExtended
|
UPDATE Fact.OrderHistoryExtended
|
||||||
SET [WWI Order ID] = [Order Key];
|
SET [WWI Order ID] = [Order Key];
|
||||||
GO
|
GO
|
||||||
+11
-1
@@ -9,7 +9,17 @@
|
|||||||
|
|
||||||
-- Email IntelligentQP@microsoft.com for questions\feedback
|
-- 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
|
GO
|
||||||
|
|
||||||
-- Compare execution time and distinct counts
|
-- Compare execution time and distinct counts
|
||||||
|
|||||||
+54
@@ -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
|
||||||
+46
@@ -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
|
||||||
+6
@@ -10,12 +10,18 @@
|
|||||||
-- Email IntelligentQP@microsoft.com for questions\feedback
|
-- Email IntelligentQP@microsoft.com for questions\feedback
|
||||||
-- ******************************************************** --
|
-- ******************************************************** --
|
||||||
|
|
||||||
|
USE [master];
|
||||||
|
GO
|
||||||
|
|
||||||
ALTER DATABASE [WideWorldImportersDW] SET COMPATIBILITY_LEVEL = 150;
|
ALTER DATABASE [WideWorldImportersDW] SET COMPATIBILITY_LEVEL = 150;
|
||||||
GO
|
GO
|
||||||
|
|
||||||
ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE;
|
ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE;
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
USE [WideWorldImportersDW];
|
||||||
|
GO
|
||||||
|
|
||||||
-- Row mode due to hint
|
-- Row mode due to hint
|
||||||
SELECT [Tax Rate],
|
SELECT [Tax Rate],
|
||||||
[Lineage Key],
|
[Lineage Key],
|
||||||
|
|||||||
+173
@@ -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
|
||||||
+7
-4
@@ -10,13 +10,16 @@
|
|||||||
-- Email IntelligentQP@microsoft.com for questions\feedback
|
-- 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
|
GO
|
||||||
|
|
||||||
ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE;
|
ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE;
|
||||||
GO
|
GO
|
||||||
|
|
||||||
USE WideWorldImportersDW;
|
USE [WideWorldImportersDW];
|
||||||
GO
|
GO
|
||||||
|
|
||||||
-- Simulate out-of-date stats
|
-- Simulate out-of-date stats
|
||||||
@@ -30,10 +33,10 @@ GO
|
|||||||
SELECT
|
SELECT
|
||||||
fo.[Order Key], fo.Description,
|
fo.[Order Key], fo.Description,
|
||||||
si.[Lead Time Days]
|
si.[Lead Time Days]
|
||||||
FROM Fact.OrderHistory AS fo
|
FROM Fact.OrderHistory AS fo
|
||||||
INNER HASH JOIN Dimension.[Stock Item] AS si
|
INNER HASH JOIN Dimension.[Stock Item] AS si
|
||||||
ON fo.[Stock Item Key] = si.[Stock Item Key]
|
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;
|
AND si.[Lead Time Days] > 19;
|
||||||
|
|
||||||
-- Cleanup
|
-- Cleanup
|
||||||
|
|||||||
+8
-6
@@ -9,19 +9,21 @@
|
|||||||
|
|
||||||
-- Email IntelligentQP@microsoft.com for questions\feedback
|
-- Email IntelligentQP@microsoft.com for questions\feedback
|
||||||
-- ******************************************************** --
|
-- ******************************************************** --
|
||||||
USE WideWorldImportersDW;
|
USE [master];
|
||||||
GO
|
GO
|
||||||
|
|
||||||
ALTER DATABASE WideWorldImportersDW
|
ALTER DATABASE [WideWorldImportersDW] SET COMPATIBILITY_LEVEL = 150;
|
||||||
SET COMPATIBILITY_LEVEL = 150;
|
|
||||||
GO
|
GO
|
||||||
|
|
||||||
ALTER DATABASE SCOPED CONFIGURATION
|
ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE;
|
||||||
CLEAR PROCEDURE_CACHE;
|
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
USE [WideWorldImportersDW];
|
||||||
|
GO
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Adapted from SQL Server Books Online
|
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
|
CREATE OR ALTER FUNCTION
|
||||||
dbo.customer_category(@CustomerKey INT)
|
dbo.customer_category(@CustomerKey INT)
|
||||||
|
|||||||
+4
-1
@@ -13,7 +13,10 @@
|
|||||||
USE [master];
|
USE [master];
|
||||||
GO
|
GO
|
||||||
|
|
||||||
ALTER DATABASE [WideWorldImportersDW] SET COMPATIBILITY_LEVEL = 140;
|
ALTER DATABASE [WideWorldImportersDW] SET COMPATIBILITY_LEVEL = 150;
|
||||||
|
GO
|
||||||
|
|
||||||
|
ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE;
|
||||||
GO
|
GO
|
||||||
|
|
||||||
USE [WideWorldImportersDW];
|
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!):
|
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)
|
- [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)
|
- [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)
|
- [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
|
REM Copy the backup file, restore the database, create necessary objects and data file
|
||||||
echo Copying sales database backup file to SQL Master instance...
|
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
|
REM Download and copy the sample backup files
|
||||||
if /i "%AW_WWI_SAMPLES%" EQU "--install-extra-samples" (
|
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
|
%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...
|
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
|
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
|
%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...
|
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
|
MASTER_POD_NAME=master-0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo Copying database backup file...
|
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 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
|
# $DEBUG rm tpcxbb_1gb.bak
|
||||||
|
|
||||||
if [ "$AW_WWI_SAMPLES" == "--install-extra-samples" ]
|
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
|
$DEBUG curl -L -G "https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/$file" -o $file
|
||||||
fi
|
fi
|
||||||
echo Copying $file database backup file to SQL Master instance...
|
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
|
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
|
$DEBUG curl -L -G "https://github.com/Microsoft/sql-server-samples/releases/download/wide-world-importers-v1.0/$file" -o $file
|
||||||
fi
|
fi
|
||||||
echo Copying $file database backup file to SQL Master instance...
|
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
|
done
|
||||||
fi
|
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:
|
# remove files copied into the pod:
|
||||||
echo Removing database backup files...
|
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
|
for table in web_clickstreams inventory customer
|
||||||
do
|
do
|
||||||
|
|||||||
@@ -70,8 +70,8 @@ GO
|
|||||||
CREATE OR ALTER PROCEDURE #create_data_sources
|
CREATE OR ALTER PROCEDURE #create_data_sources
|
||||||
AS
|
AS
|
||||||
BEGIN
|
BEGIN
|
||||||
-- Create database master key (required for database scoped credentials used in the samples)
|
-- 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)
|
IF NOT EXISTS(SELECT * FROM sys.symmetric_keys WHERE name = '##MS_DatabaseMasterKey##')
|
||||||
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'sql19bigdatacluster!';
|
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'sql19bigdatacluster!';
|
||||||
|
|
||||||
-- Create default data sources for SQL Big Data Cluster
|
-- Create default data sources for SQL Big Data Cluster
|
||||||
|
|||||||
+5
-6
@@ -4,16 +4,15 @@
|
|||||||
-- the Query menu, and "Specify Values for Template Parameters" option.
|
-- the Query menu, and "Specify Values for Template Parameters" option.
|
||||||
IF NOT EXISTS(SELECT * FROM sys.database_scoped_credentials WHERE name = 'MySQL80-user')
|
IF NOT EXISTS(SELECT * FROM sys.database_scoped_credentials WHERE name = 'MySQL80-user')
|
||||||
CREATE DATABASE SCOPED CREDENTIAL [MySQL80-user]
|
CREATE DATABASE SCOPED CREDENTIAL [MySQL80-user]
|
||||||
WITH IDENTITY = 'mssql-user'
|
WITH IDENTITY = '<mysql_user,nvarchar(100),mssql-user>'
|
||||||
, SECRET = 'sql19tw0mysql';
|
, SECRET = '<mysql_user_password,nvarchar(100),sql19tw0mysql>';
|
||||||
|
|
||||||
-- Create external data source that points to MySQL server
|
-- Create external data source that points to MySQL server.
|
||||||
-- The tokens '%u' and '%p' is used to reference the credential information.
|
|
||||||
--
|
--
|
||||||
IF NOT EXISTS(SELECT * FROM sys.external_data_sources WHERE name = 'MySQL80')
|
IF NOT EXISTS(SELECT * FROM sys.external_data_sources WHERE name = 'MySQL80')
|
||||||
CREATE EXTERNAL DATA SOURCE MySQL80
|
CREATE EXTERNAL DATA SOURCE MySQL80
|
||||||
WITH (LOCATION = 'odbc://uc-win19-vm.redmond.corp.microsoft.com'
|
WITH (LOCATION = 'odbc://<mysql_server,nvarchar(100),mysql-server-name>'
|
||||||
, CONNECTION_OPTIONS = 'Driver={MySQL ODBC 8.0 Unicode Driver};User name=%u;Passwword=%p;IGNORE_SPACE=1'
|
, CONNECTION_OPTIONS = 'Driver={MySQL ODBC 8.0 Unicode Driver};IGNORE_SPACE=1'
|
||||||
, CREDENTIAL = [MySQL80-user]);
|
, CREDENTIAL = [MySQL80-user]);
|
||||||
|
|
||||||
-- Create external table over inventory table on MySQL server
|
-- Create external table over inventory table on MySQL server
|
||||||
|
|||||||
+2
-3
@@ -7,13 +7,12 @@ IF NOT EXISTS(SELECT * FROM sys.database_scoped_credentials WHERE name = 'Postgr
|
|||||||
WITH IDENTITY = '<postgres_user,nvarchar(100),mssql-user>'
|
WITH IDENTITY = '<postgres_user,nvarchar(100),mssql-user>'
|
||||||
, SECRET = '<postgres_user_password,nvarchar(100),sql19tw0postgresql>';
|
, SECRET = '<postgres_user_password,nvarchar(100),sql19tw0postgresql>';
|
||||||
|
|
||||||
-- Create external data source that points to PostgreSQL server
|
-- Create external data source that points to PostgreSQL server.
|
||||||
-- The tokens '%u' and '%p' is used to reference the credential information.
|
|
||||||
--
|
--
|
||||||
IF NOT EXISTS(SELECT * FROM sys.external_data_sources WHERE name = 'PostgreSQL11')
|
IF NOT EXISTS(SELECT * FROM sys.external_data_sources WHERE name = 'PostgreSQL11')
|
||||||
CREATE EXTERNAL DATA SOURCE PostgreSQL11
|
CREATE EXTERNAL DATA SOURCE PostgreSQL11
|
||||||
WITH (LOCATION = 'odbc://<postgres_server,nvarchar(100),postgres-server-name>'
|
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]);
|
, CREDENTIAL = [PostgreSQL11-user]);
|
||||||
|
|
||||||
-- Create external table over inventory table on PostgreSQL server
|
-- Create external table over inventory table on PostgreSQL server
|
||||||
|
|||||||
+1
-1
@@ -203,7 +203,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"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": {}
|
"metadata": {}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ To run this sample, you need the following prerequisites.
|
|||||||
|
|
||||||
**Software prerequisites:**
|
**Software prerequisites:**
|
||||||
|
|
||||||
1. PowerShell 5.1
|
1. PowerShell 5.1 or PowerShell Core 6.0
|
||||||
2. Azure PowerShell 5.4.2 or higher
|
2. Azure PowerShell Az module
|
||||||
|
|
||||||
**Azure prerequisites:**
|
**Azure prerequisites:**
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ To run this sample, you need the following prerequisites.
|
|||||||
|
|
||||||
## Run this sample
|
## 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
|
```powershell
|
||||||
|
|
||||||
|
|||||||
@@ -1,47 +1,69 @@
|
|||||||
$parameters = $args[0]
|
$parameters = $args[0]
|
||||||
|
$scriptUrlBase = $args[1]
|
||||||
|
|
||||||
$subscriptionId = $parameters['subscriptionId']
|
$subscriptionId = $parameters['subscriptionId']
|
||||||
$resourceGroupName = $parameters['resourceGroupName']
|
$resourceGroupName = $parameters['resourceGroupName']
|
||||||
$virtualMachineName = $parameters['virtualMachineName']
|
$virtualMachineName = $parameters['virtualMachineName']
|
||||||
$virtualNetworkName = $parameters['virtualNetworkName']
|
$virtualNetworkName = $parameters['virtualNetworkName']
|
||||||
$managementSubnetName = $parameters['subnetName']
|
$managementSubnetName = $parameters['subnetName']
|
||||||
$administratorLogin = $parameters['administratorLogin']
|
$administratorLogin = $parameters['administratorLogin']
|
||||||
$administratorLoginPassword = $parameters['administratorLoginPassword']
|
$administratorLoginPassword = $parameters['administratorLoginPassword']
|
||||||
|
|
||||||
$scriptUrlBase = $args[1]
|
if ($virtualMachineName -eq '' -or ($null -eq $virtualMachineName)) {
|
||||||
|
|
||||||
if($virtualMachineName -eq '' -or $virtualMachineName -eq $null) {
|
|
||||||
$virtualMachineName = 'Jumpbox'
|
$virtualMachineName = 'Jumpbox'
|
||||||
Write-Host "VM Name: 'Jumpbox'." -ForegroundColor Green
|
Write-Host "VM Name: 'Jumpbox'." -ForegroundColor Green
|
||||||
}
|
}
|
||||||
|
|
||||||
if($managementSubnetName -eq '' -or $managementSubnetName -eq $null) {
|
if ($managementSubnetName -eq '' -or ($null -eq $managementSubnetName)) {
|
||||||
$managementSubnetName = 'Management'
|
$managementSubnetName = 'Management'
|
||||||
Write-Host "Using subnet 'Management' to deploy jumpbox VM." -ForegroundColor Green
|
Write-Host "Using subnet 'Management' to deploy jumpbox VM." -ForegroundColor Green
|
||||||
}
|
}
|
||||||
|
|
||||||
function VerifyPSVersion
|
function VerifyPSVersion {
|
||||||
{
|
Write-Host "Verifying PowerShell version."
|
||||||
Write-Host "Verifying PowerShell version, must be 5.0 or higher."
|
if ($PSVersionTable.PSEdition -eq "Desktop") {
|
||||||
if($PSVersionTable.PSVersion.Major -ge 5)
|
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
|
Write-Host "PowerShell version verified." -ForegroundColor Green
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "You need to install PowerShell version 5.1 or heigher." -ForegroundColor Red
|
||||||
|
Break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
if ($PSVersionTable.PSVersion.Major -ge 6) {
|
||||||
Write-Host "You need to install PowerShell version 5.0 or heigher." -ForegroundColor Red
|
Write-Host "PowerShell version verified." -ForegroundColor Green
|
||||||
Break;
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "You need to install PowerShell version 6.0 or heigher." -ForegroundColor Red
|
||||||
|
Break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function EnsureLogin ()
|
function EnsureAzModule {
|
||||||
{
|
Write-Host "Checking if Az module is imported."
|
||||||
$context = Get-AzureRmContext
|
$module = Get-Module Az
|
||||||
If($null -eq $context.Subscription)
|
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..."
|
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
|
Write-Host ("Sign-in failed: {0}" -f $Errors[0].Exception.Message) -ForegroundColor Red
|
||||||
Break
|
Break
|
||||||
}
|
}
|
||||||
@@ -54,16 +76,14 @@ function SelectSubscriptionId {
|
|||||||
$subscriptionId
|
$subscriptionId
|
||||||
)
|
)
|
||||||
Write-Host "Selecting subscription '$subscriptionId'..."
|
Write-Host "Selecting subscription '$subscriptionId'..."
|
||||||
$context = Get-AzureRmContext
|
$context = Get-AzContext
|
||||||
If($context.Subscription.Id -ne $subscriptionId)
|
If ($context.Subscription.Id -ne $subscriptionId) {
|
||||||
{
|
Try {
|
||||||
Try
|
$currentSubscriptionId = $context.Subscription.Id
|
||||||
{
|
Write-Host "Switching subscription $currentSubscriptionId to '$subscriptionId'." -ForegroundColor Green
|
||||||
Write-Host "Switching subscription $context.Subscription.Id to '$subscriptionId'." -ForegroundColor Green
|
Select-AzSubscription -SubscriptionId $subscriptionId -ErrorAction Stop | Out-null
|
||||||
Select-AzureRmSubscription -SubscriptionId $subscriptionId -ErrorAction Stop | Out-null
|
|
||||||
}
|
}
|
||||||
Catch
|
Catch {
|
||||||
{
|
|
||||||
Write-Host "Subscription selection failed: $_" -ForegroundColor Red
|
Write-Host "Subscription selection failed: $_" -ForegroundColor Red
|
||||||
Break
|
Break
|
||||||
}
|
}
|
||||||
@@ -76,59 +96,52 @@ function LoadVirtualNetwork {
|
|||||||
$resourceGroupName,
|
$resourceGroupName,
|
||||||
$virtualNetworkName
|
$virtualNetworkName
|
||||||
)
|
)
|
||||||
Write-Host("Loading virtual network '{0}' in resource group '{1}'." -f $virtualNetworkName, $resourceGroupName)
|
Write-Host("Loading virtual network '{0}' in resource group '{1}'." -f $virtualNetworkName, $resourceGroupName)
|
||||||
$virtualNetwork = Get-AzureRmVirtualNetwork -ResourceGroupName $resourceGroupName -Name $virtualNetworkName -ErrorAction SilentlyContinue
|
$virtualNetwork = Get-AzVirtualNetwork -ResourceGroupName $resourceGroupName -Name $virtualNetworkName -ErrorAction SilentlyContinue
|
||||||
$id = $virtualNetwork.Id
|
$id = $virtualNetwork.Id
|
||||||
If($null -ne $id)
|
If ($null -ne $id) {
|
||||||
{
|
Write-Host "Virtual network with id $id is loaded." -ForegroundColor Green
|
||||||
Write-Host "Virtual network with id $id is loaded." -ForegroundColor Green
|
If ($virtualNetwork.VirtualNetworkPeerings.Count -gt 0) {
|
||||||
If($virtualNetwork.VirtualNetworkPeerings.Count -gt 0) {
|
Write-Host "Virtual network is loaded, but it should not have peerings." -ForegroundColor Red
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
return $virtualNetwork
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "Virtual network $virtualNetworkName cannot be found." -ForegroundColor Red
|
||||||
|
Break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetVirtualNetwork
|
function SetVirtualNetwork {
|
||||||
{
|
|
||||||
param($virtualNetwork)
|
param($virtualNetwork)
|
||||||
|
|
||||||
Write-Host "Applying changes to the virtual network."
|
Write-Host "Applying changes to the virtual network."
|
||||||
Try
|
Try {
|
||||||
{
|
Set-AzVirtualNetwork -VirtualNetwork $virtualNetwork -ErrorAction Stop | Out-Null
|
||||||
Set-AzureRmVirtualNetwork -VirtualNetwork $virtualNetwork -ErrorAction Stop | Out-Null
|
|
||||||
}
|
}
|
||||||
Catch
|
Catch {
|
||||||
{
|
|
||||||
Write-Host "Failed to configure Virtual Network: $_" -ForegroundColor Red
|
Write-Host "Failed to configure Virtual Network: $_" -ForegroundColor Red
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ConvertCidrToUint32Array
|
function ConvertCidrToUint32Array {
|
||||||
{
|
|
||||||
param($cidrRange)
|
param($cidrRange)
|
||||||
$cidrRangeParts = $cidrRange.Split("/")
|
$cidrRangeParts = $cidrRange.Split("/")
|
||||||
$ipParts = $cidrRangeParts[0].Split(".")
|
$ipParts = $cidrRangeParts[0].Split(".")
|
||||||
$ipnum = ([Convert]::ToUInt32($ipParts[0]) -shl 24) -bor `
|
$ipnum = ([Convert]::ToUInt32($ipParts[0]) -shl 24) -bor `
|
||||||
([Convert]::ToUInt32($ipParts[1]) -shl 16) -bor `
|
([Convert]::ToUInt32($ipParts[1]) -shl 16) -bor `
|
||||||
([Convert]::ToUInt32($ipParts[2]) -shl 8) -bor `
|
([Convert]::ToUInt32($ipParts[2]) -shl 8) -bor `
|
||||||
[Convert]::ToUInt32($ipParts[3])
|
[Convert]::ToUInt32($ipParts[3])
|
||||||
|
|
||||||
$maskbits = [System.Convert]::ToInt32($cidrRangeParts[1])
|
$maskbits = [System.Convert]::ToInt32($cidrRangeParts[1])
|
||||||
$mask = 0xffffffff
|
$mask = 0xffffffff
|
||||||
$mask = $mask -shl (32 -$maskbits)
|
$mask = $mask -shl (32 - $maskbits)
|
||||||
$ipstart = $ipnum -band $mask
|
$ipstart = $ipnum -band $mask
|
||||||
$ipend = $ipnum -bor ($mask -bxor 0xffffffff)
|
$ipend = $ipnum -bor ($mask -bxor 0xffffffff)
|
||||||
return @($ipstart, $ipend)
|
return @($ipstart, $ipend)
|
||||||
}
|
}
|
||||||
|
|
||||||
function ConvertUInt32ToIPAddress
|
function ConvertUInt32ToIPAddress {
|
||||||
{
|
|
||||||
param($uint32IP)
|
param($uint32IP)
|
||||||
$v1 = $uint32IP -band 0xff
|
$v1 = $uint32IP -band 0xff
|
||||||
$v2 = ($uint32IP -shr 8) -band 0xff
|
$v2 = ($uint32IP -shr 8) -band 0xff
|
||||||
@@ -137,16 +150,13 @@ function ConvertUInt32ToIPAddress
|
|||||||
return "$v4.$v3.$v2.$v1"
|
return "$v4.$v3.$v2.$v1"
|
||||||
}
|
}
|
||||||
|
|
||||||
function CalculateNextAddressPrefix
|
function CalculateNextAddressPrefix {
|
||||||
{
|
|
||||||
param($virtualNetwork, $prefixLength)
|
param($virtualNetwork, $prefixLength)
|
||||||
Write-Host "Calculating address prefix with length $prefixLength..."
|
Write-Host "Calculating address prefix with length $prefixLength..."
|
||||||
$startIPAddress = 0
|
$startIPAddress = 0
|
||||||
ForEach($addressPrefix in $virtualNetwork.AddressSpace.AddressPrefixes)
|
ForEach ($addressPrefix in $virtualNetwork.AddressSpace.AddressPrefixes) {
|
||||||
{
|
|
||||||
$endIPAddress = (ConvertCidrToUint32Array $addressPrefix)[1]
|
$endIPAddress = (ConvertCidrToUint32Array $addressPrefix)[1]
|
||||||
If($endIPAddress -gt $startIPAddress)
|
If ($endIPAddress -gt $startIPAddress) {
|
||||||
{
|
|
||||||
$startIPAddress = $endIPAddress
|
$startIPAddress = $endIPAddress
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -156,22 +166,20 @@ function CalculateNextAddressPrefix
|
|||||||
return $addressPrefixResult
|
return $addressPrefixResult
|
||||||
}
|
}
|
||||||
|
|
||||||
function CalculateVpnClientAddressPoolPrefix
|
function CalculateVpnClientAddressPoolPrefix {
|
||||||
{
|
|
||||||
param($gatewaySubnetPrefix)
|
param($gatewaySubnetPrefix)
|
||||||
Write-Host "Calculating VPN client address pool prefix."
|
Write-Host "Calculating VPN client address pool prefix."
|
||||||
If($gatewaySubnetPrefix.StartsWith("10."))
|
If ($gatewaySubnetPrefix.StartsWith("10.")) {
|
||||||
{
|
|
||||||
return "192.168.0.0/24"
|
return "192.168.0.0/24"
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
return "172.16.0.0/24"
|
return "172.16.0.0/24"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VerifyPSVersion
|
VerifyPSVersion
|
||||||
|
EnsureAzModule
|
||||||
EnsureLogin
|
EnsureLogin
|
||||||
SelectSubscriptionId -subscriptionId $subscriptionId
|
SelectSubscriptionId -subscriptionId $subscriptionId
|
||||||
|
|
||||||
@@ -179,34 +187,36 @@ $virtualNetwork = LoadVirtualNetwork -resourceGroupName $resourceGroupName -virt
|
|||||||
|
|
||||||
$subnets = $virtualNetwork.Subnets.Name
|
$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 "$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
|
$managementSubnetPrefix = CalculateNextAddressPrefix $virtualNetwork 28
|
||||||
|
Write-Host "Creating subnet $managementSubnetName ($managementSubnetPrefix) in the virtual network ..." -ForegroundColor Green
|
||||||
|
|
||||||
$virtualNetwork.AddressSpace.AddressPrefixes.Add($managementSubnetPrefix)
|
$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
|
SetVirtualNetwork $virtualNetwork
|
||||||
Write-Host "Added subnet $managementSubnetName into VNet." -ForegroundColor Green
|
Write-Host "Added subnet $managementSubnetName into virtual network." -ForegroundColor Green
|
||||||
} else {
|
}
|
||||||
Write-Host "The subnet $managementSubnetName exists in the VNet." -ForegroundColor Green
|
else {
|
||||||
|
Write-Host "The subnet $managementSubnetName exists in the virtual network." -ForegroundColor Green
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host
|
Write-Host
|
||||||
|
|
||||||
# Start the deployment
|
# Start the deployment
|
||||||
Write-Host "Starting deployment..."
|
Write-Host "Starting deployment..."
|
||||||
|
Write-Host "Deployment will take about 20m." -ForegroundColor Yellow
|
||||||
|
|
||||||
$templateParameters = @{
|
$templateParameters = @{
|
||||||
virtualNetworkName = $virtualNetworkName
|
location = $virtualNetwork.Location
|
||||||
managementSubnetName = $managementSubnetName
|
virtualNetworkName = $virtualNetworkName
|
||||||
virtualMachineName = $virtualMachineName
|
managementSubnetName = $managementSubnetName
|
||||||
administratorLogin = $administratorLogin
|
virtualMachineName = $virtualMachineName
|
||||||
administratorLoginPassword = $administratorLoginPassword
|
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."
|
Write-Host "Deployment completed."
|
||||||
|
|||||||
@@ -29,8 +29,11 @@ To run this sample, you need the following prerequisites.
|
|||||||
|
|
||||||
**Software prerequisites:**
|
**Software prerequisites:**
|
||||||
|
|
||||||
1. PowerShell 5.1
|
1. PowerShell 5.1 or PowerShell Core 6.0
|
||||||
2. Azure PowerShell 5.4.2 or higher
|
2. Azure PowerShell Az module
|
||||||
|
|
||||||
|
**Linux prerequisites**
|
||||||
|
1. strongSwan
|
||||||
|
|
||||||
**Azure prerequisites:**
|
**Azure prerequisites:**
|
||||||
|
|
||||||
@@ -40,7 +43,7 @@ To run this sample, you need the following prerequisites.
|
|||||||
|
|
||||||
## Run this sample
|
## Run this sample
|
||||||
|
|
||||||
Run the script below from Windows PowerShell
|
Run the script below from PowerShell
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
|
|
||||||
|
|||||||
+172
-121
@@ -1,56 +1,82 @@
|
|||||||
$parameters = $args[0]
|
$parameters = $args[0]
|
||||||
|
$scriptUrlBase = $args[1]
|
||||||
|
|
||||||
$subscriptionId = $parameters['subscriptionId']
|
$subscriptionId = $parameters['subscriptionId']
|
||||||
$resourceGroupName = $parameters['resourceGroupName']
|
$resourceGroupName = $parameters['resourceGroupName']
|
||||||
$virtualNetworkName = $parameters['virtualNetworkName']
|
$virtualNetworkName = $parameters['virtualNetworkName']
|
||||||
$certificateNamePrefix = $parameters['certificateNamePrefix']
|
$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
|
function VerifyPSVersion {
|
||||||
{
|
Write-Host "Verifying PowerShell version."
|
||||||
Write-Host "Verifying PowerShell version, must be 5.0 or higher."
|
if ($PSVersionTable.PSEdition -eq "Desktop") {
|
||||||
if($PSVersionTable.PSVersion.Major -ge 5)
|
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
|
Write-Host "PowerShell version verified." -ForegroundColor Green
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "You need to install PowerShell version 5.1 or heigher." -ForegroundColor Red
|
||||||
|
Break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
if ($PSVersionTable.PSVersion.Major -ge 6) {
|
||||||
Write-Host "You need to install PowerShell version 5.0 or heigher." -ForegroundColor Red
|
Write-Host "PowerShell version verified." -ForegroundColor Green
|
||||||
Break;
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "You need to install PowerShell version 6.0 or heigher." -ForegroundColor Red
|
||||||
|
Break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Ensure-Login ()
|
function EnsureAzModule {
|
||||||
{
|
Write-Host "Checking if Az module is imported."
|
||||||
$context = Get-AzureRmContext
|
$module = Get-Module Az
|
||||||
If($context.Subscription -eq $null)
|
If ($null -eq $module) {
|
||||||
{
|
try {
|
||||||
Write-Host "Loging in ..."
|
Import-Module Az -ErrorAction Stop
|
||||||
If((Login-AzureRmAccount -ErrorAction SilentlyContinue -ErrorVariable Errors) -eq $null)
|
Write-Host "Module Az imported." -ForegroundColor Green
|
||||||
{
|
}
|
||||||
Write-Host ("Login failed: {0}" -f $Errors[0].Exception.Message) -ForegroundColor Red
|
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
|
Break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Write-Host "User logedin." -ForegroundColor Green
|
Write-Host "Sign-in successful." -ForegroundColor Green
|
||||||
}
|
}
|
||||||
|
|
||||||
function Select-SubscriptionId {
|
function SelectSubscriptionId {
|
||||||
param (
|
param (
|
||||||
$subscriptionId
|
$subscriptionId
|
||||||
)
|
)
|
||||||
Write-Host "Selecting subscription '$subscriptionId'."
|
Write-Host "Selecting subscription '$subscriptionId'..."
|
||||||
$context = Get-AzureRmContext
|
$context = Get-AzContext
|
||||||
If($context.Subscription.Id -ne $subscriptionId)
|
If ($context.Subscription.Id -ne $subscriptionId) {
|
||||||
{
|
Try {
|
||||||
Try
|
$currentSubscriptionId = $context.Subscription.Id
|
||||||
{
|
Write-Host "Switching subscription $currentSubscriptionId to '$subscriptionId'." -ForegroundColor Green
|
||||||
Select-AzureRmSubscription -SubscriptionId $subscriptionId -ErrorAction Stop | Out-null
|
Select-AzSubscription -SubscriptionId $subscriptionId -ErrorAction Stop | Out-null
|
||||||
}
|
}
|
||||||
Catch
|
Catch {
|
||||||
{
|
|
||||||
Write-Host "Subscription selection failed: $_" -ForegroundColor Red
|
Write-Host "Subscription selection failed: $_" -ForegroundColor Red
|
||||||
Break
|
Break
|
||||||
}
|
}
|
||||||
@@ -58,78 +84,57 @@ function Select-SubscriptionId {
|
|||||||
Write-Host "Subscription selected." -ForegroundColor Green
|
Write-Host "Subscription selected." -ForegroundColor Green
|
||||||
}
|
}
|
||||||
|
|
||||||
function Load-VirtualNetwork {
|
function LoadVirtualNetwork {
|
||||||
param (
|
param (
|
||||||
$resourceGroupName,
|
$resourceGroupName,
|
||||||
$virtualNetworkName
|
$virtualNetworkName
|
||||||
)
|
)
|
||||||
Write-Host("Loading virtual network '{0}' in resource group '{1}'." -f $virtualNetworkName, $resourceGroupName)
|
Write-Host("Loading virtual network '{0}' in resource group '{1}'." -f $virtualNetworkName, $resourceGroupName)
|
||||||
$virtualNetwork = Get-AzureRmVirtualNetwork -ResourceGroupName $resourceGroupName -Name $virtualNetworkName -ErrorAction SilentlyContinue
|
$virtualNetwork = Get-AzVirtualNetwork -ResourceGroupName $resourceGroupName -Name $virtualNetworkName -ErrorAction SilentlyContinue
|
||||||
If($virtualNetwork.Id -ne $null)
|
$id = $virtualNetwork.Id
|
||||||
{
|
If ($null -ne $id) {
|
||||||
Write-Host "Virtual network loaded." -ForegroundColor Green
|
Write-Host "Virtual network with id $id is loaded." -ForegroundColor Green
|
||||||
return $virtualNetwork
|
If ($virtualNetwork.VirtualNetworkPeerings.Count -gt 0) {
|
||||||
|
Write-Host "Virtual network is loaded, but it should not have peerings." -ForegroundColor Red
|
||||||
}
|
}
|
||||||
else
|
return $virtualNetwork
|
||||||
{
|
|
||||||
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
|
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
Write-Host "Virtual network $virtualNetworkName cannot be found." -ForegroundColor Red
|
||||||
Write-Host "Resource group not found." -ForegroundColor Red
|
|
||||||
Break
|
Break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Set-VirtualNetwork
|
function SetVirtualNetwork {
|
||||||
{
|
|
||||||
param($virtualNetwork)
|
param($virtualNetwork)
|
||||||
|
|
||||||
Write-Host "Applying changes to the virtual network."
|
Write-Host "Applying changes to the virtual network."
|
||||||
Try
|
Try {
|
||||||
{
|
Set-AzVirtualNetwork -VirtualNetwork $virtualNetwork -ErrorAction Stop | Out-Null
|
||||||
Set-AzureRmVirtualNetwork -VirtualNetwork $virtualNetwork -ErrorAction Stop | Out-Null
|
|
||||||
}
|
}
|
||||||
Catch
|
Catch {
|
||||||
{
|
Write-Host "Failed to configure Virtual Network: $_" -ForegroundColor Red
|
||||||
Write-Host "Failed: $_" -ForegroundColor Red
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function ConvertCidrToUint32Array
|
function ConvertCidrToUint32Array {
|
||||||
{
|
|
||||||
param($cidrRange)
|
param($cidrRange)
|
||||||
$cidrRangeParts = $cidrRange.Split(@(".","/"))
|
$cidrRangeParts = $cidrRange.Split("/")
|
||||||
$ipnum = ([Convert]::ToUInt32($cidrRangeParts[0]) -shl 24) -bor `
|
$ipParts = $cidrRangeParts[0].Split(".")
|
||||||
([Convert]::ToUInt32($cidrRangeParts[1]) -shl 16) -bor `
|
$ipnum = ([Convert]::ToUInt32($ipParts[0]) -shl 24) -bor `
|
||||||
([Convert]::ToUInt32($cidrRangeParts[2]) -shl 8) -bor `
|
([Convert]::ToUInt32($ipParts[1]) -shl 16) -bor `
|
||||||
[Convert]::ToUInt32($cidrRangeParts[3])
|
([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 = 0xffffffff
|
||||||
$mask = $mask -shl (32 -$maskbits)
|
$mask = $mask -shl (32 - $maskbits)
|
||||||
$ipstart = $ipnum -band $mask
|
$ipstart = $ipnum -band $mask
|
||||||
$ipend = $ipnum -bor ($mask -bxor 0xffffffff)
|
$ipend = $ipnum -bor ($mask -bxor 0xffffffff)
|
||||||
return @($ipstart, $ipend)
|
return @($ipstart, $ipend)
|
||||||
}
|
}
|
||||||
|
|
||||||
function ConvertUInt32ToIPAddress
|
function ConvertUInt32ToIPAddress {
|
||||||
{
|
|
||||||
param($uint32IP)
|
param($uint32IP)
|
||||||
$v1 = $uint32IP -band 0xff
|
$v1 = $uint32IP -band 0xff
|
||||||
$v2 = ($uint32IP -shr 8) -band 0xff
|
$v2 = ($uint32IP -shr 8) -band 0xff
|
||||||
@@ -138,80 +143,126 @@ function ConvertUInt32ToIPAddress
|
|||||||
return "$v4.$v3.$v2.$v1"
|
return "$v4.$v3.$v2.$v1"
|
||||||
}
|
}
|
||||||
|
|
||||||
function CalculateNextAddressPrefix
|
function CalculateNextAddressPrefix {
|
||||||
{
|
|
||||||
param($virtualNetwork, $prefixLength)
|
param($virtualNetwork, $prefixLength)
|
||||||
Write-Host "Calculating address prefix."
|
Write-Host "Calculating address prefix with length $prefixLength..."
|
||||||
$startIPAddress = 0
|
$startIPAddress = 0
|
||||||
ForEach($addressPrefix in $virtualNetwork.AddressSpace.AddressPrefixes)
|
ForEach ($addressPrefix in $virtualNetwork.AddressSpace.AddressPrefixes) {
|
||||||
{
|
|
||||||
$endIPAddress = (ConvertCidrToUint32Array $addressPrefix)[1]
|
$endIPAddress = (ConvertCidrToUint32Array $addressPrefix)[1]
|
||||||
If($endIPAddress -gt $startIPAddress)
|
If ($endIPAddress -gt $startIPAddress) {
|
||||||
{
|
|
||||||
$startIPAddress = $endIPAddress
|
$startIPAddress = $endIPAddress
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$startIPAddress += 1
|
$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)
|
param($gatewaySubnetPrefix)
|
||||||
Write-Host "Calculating VPN client address pool prefix."
|
Write-Host "Calculating VPN client address pool prefix."
|
||||||
If($gatewaySubnetPrefix.StartsWith("10."))
|
If ($gatewaySubnetPrefix.StartsWith("10.")) {
|
||||||
{
|
|
||||||
return "192.168.0.0/24"
|
return "192.168.0.0/24"
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
return "172.16.0.0/24"
|
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
|
VerifyPSVersion
|
||||||
Ensure-Login
|
EnsureAzModule
|
||||||
Select-SubscriptionId -subscriptionId $subscriptionId
|
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 `
|
$gatewaySubnetName = "GatewaySubnet"
|
||||||
-Subject ("CN=$certificateNamePrefix"+"P2SRoot") -KeyExportPolicy Exportable `
|
|
||||||
-HashAlgorithm sha256 -KeyLength 2048 `
|
|
||||||
-CertStoreLocation "Cert:\CurrentUser\My" -KeyUsageProperty Sign -KeyUsage CertSign
|
|
||||||
|
|
||||||
$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 `
|
$virtualNetwork.AddressSpace.AddressPrefixes.Add($gatewaySubnetPrefix)
|
||||||
-Subject ("CN=$certificateNamePrefix"+"P2SChild") -KeyExportPolicy Exportable `
|
Add-AzVirtualNetworkSubnetConfig -Name $gatewaySubnetName -VirtualNetwork $virtualNetwork -AddressPrefix $gatewaySubnetPrefix | Out-Null
|
||||||
-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)
|
SetVirtualNetwork $virtualNetwork
|
||||||
|
Write-Host "Added subnet $gatewaySubnetName into virtual network." -ForegroundColor Green
|
||||||
$gatewaySubnetPrefix = CalculateNextAddressPrefix $virtualNetwork 28
|
}
|
||||||
|
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
|
$vpnClientAddressPoolPrefix = CalculateVpnClientAddressPoolPrefix $gatewaySubnetPrefix
|
||||||
|
$publicRootCertData = CreateCertificate
|
||||||
$virtualNetwork.AddressSpace.AddressPrefixes.Add($gatewaySubnetPrefix)
|
|
||||||
Add-AzureRmVirtualNetworkSubnetConfig -Name GatewaySubnet -VirtualNetwork $virtualNetwork -AddressPrefix $gatewaySubnetPrefix | Out-Null
|
|
||||||
|
|
||||||
Set-VirtualNetwork $virtualNetwork
|
|
||||||
|
|
||||||
Write-Host
|
Write-Host
|
||||||
|
|
||||||
# Start the deployment
|
# Start the deployment
|
||||||
Write-Host "Starting deployment..."
|
Write-Host "Starting deployment..."
|
||||||
|
Write-Host "Deployment will take about 1h." -ForegroundColor Yellow
|
||||||
|
|
||||||
$templateParameters = @{
|
$templateParameters = @{
|
||||||
virtualNetworkName = $virtualNetworkName
|
location = $virtualNetwork.Location
|
||||||
gatewaySubnetPrefix = $gatewaySubnetPrefix
|
virtualNetworkName = $virtualNetworkName
|
||||||
vpnClientAddressPoolPrefix = $vpnClientAddressPoolPrefix
|
gatewaySubnetPrefix = $gatewaySubnetPrefix
|
||||||
publicRootCertData = $publicRootCertData
|
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."
|
||||||
-217
@@ -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": {
|
"variables": {
|
||||||
"gatewayPublicIpAddressName": "[concat('GatewayIP-', uniqueString(resourceGroup().id))]",
|
"gatewayPublicIpAddressName": "[concat('GatewayIP-', uniqueString(resourceGroup().id))]",
|
||||||
"gatewayName": "[concat('Gateway-', uniqueString(resourceGroup().id))]",
|
"gatewayName": "[concat('Gateway-', uniqueString(resourceGroup().id))]",
|
||||||
"gatewaySku": "Basic",
|
|
||||||
"gatewaySubnetName": "GatewaySubnet",
|
"gatewaySubnetName": "GatewaySubnet",
|
||||||
"clientRootCertName": "RootCert"
|
"clientRootCertName": "RootCert"
|
||||||
},
|
},
|
||||||
@@ -46,7 +45,7 @@
|
|||||||
"apiVersion": "2017-10-01",
|
"apiVersion": "2017-10-01",
|
||||||
"type": "Microsoft.Network/publicIPAddresses",
|
"type": "Microsoft.Network/publicIPAddresses",
|
||||||
"name": "[variables('gatewayPublicIpAddressName')]",
|
"name": "[variables('gatewayPublicIpAddressName')]",
|
||||||
"location": "[resourceGroup().location]",
|
"location": "[parameters('location')]",
|
||||||
"properties": {
|
"properties": {
|
||||||
"publicIPAllocationMethod": "Dynamic"
|
"publicIPAllocationMethod": "Dynamic"
|
||||||
}
|
}
|
||||||
@@ -55,7 +54,7 @@
|
|||||||
"apiVersion": "2017-10-01",
|
"apiVersion": "2017-10-01",
|
||||||
"type": "Microsoft.Network/virtualNetworkGateways",
|
"type": "Microsoft.Network/virtualNetworkGateways",
|
||||||
"name": "[variables('gatewayName')]",
|
"name": "[variables('gatewayName')]",
|
||||||
"location": "[resourceGroup().location]",
|
"location": "[parameters('location')]",
|
||||||
"dependsOn": [
|
"dependsOn": [
|
||||||
"[concat('Microsoft.Network/publicIPAddresses/', variables('gatewayPublicIpAddressName'))]"
|
"[concat('Microsoft.Network/publicIPAddresses/', variables('gatewayPublicIpAddressName'))]"
|
||||||
],
|
],
|
||||||
@@ -75,8 +74,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"sku": {
|
"sku": {
|
||||||
"name": "[variables('gatewaySku')]",
|
"name": "Standard",
|
||||||
"tier": "[variables('gatewaySku')]"
|
"tier": "Standard"
|
||||||
},
|
},
|
||||||
"gatewayType": "Vpn",
|
"gatewayType": "Vpn",
|
||||||
"vpnType": "RouteBased",
|
"vpnType": "RouteBased",
|
||||||
@@ -87,6 +86,10 @@
|
|||||||
"[parameters('vpnClientAddressPoolPrefix')]"
|
"[parameters('vpnClientAddressPoolPrefix')]"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"vpnClientProtocols": [
|
||||||
|
"IkeV2",
|
||||||
|
"SSTP"
|
||||||
|
],
|
||||||
"vpnClientRootCertificates": [
|
"vpnClientRootCertificates": [
|
||||||
{
|
{
|
||||||
"name": "[variables('clientRootCertName')]",
|
"name": "[variables('clientRootCertName')]",
|
||||||
@@ -99,4 +102,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
+48
@@ -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
|
||||||
|
|
||||||
+42
@@ -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;
|
||||||
|
|
||||||
Reference in New Issue
Block a user