Skip to content

Commit bf645f4

Browse files
author
cloudmelon
committed
Merge branch 'microsoft-master'
2 parents 56ff566 + 1094a51 commit bf645f4

File tree

9 files changed

+245
-177
lines changed

9 files changed

+245
-177
lines changed

.gitattributes

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
test_LFS.bak filter=lfs diff=lfs merge=lfs -text
2-
*.tar filter=lfs diff=lfs merge=lfs -text
1.21 MB
Binary file not shown.

samples/demos/azure-sql-edge-demos/iron-ore-silica-impurities/tar-files/ironoresilicaprediction-amd.tar

Lines changed: 0 additions & 3 deletions
This file was deleted.

samples/demos/azure-sql-edge-demos/iron-ore-silica-impurities/tar-files/ironoresilicaprediction-arm.tar

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Azure SQL Demos
22

3-
In this folder, you will find the required files to execute the [Iron Ore Silica Impurities Demo](https://docs.microsoft.com/en-us/azure/azure-sql-edge/tutorial-deploy-azure-resources)
4-
1. DACPAC or Data Tier AppliCation Package is a single file which contains database model i.e. all files represent database objects. This file can be downloaded [here](https://github.com/microsoft/sql-server-samples/tree/master/samples/demos/azure-sql-edge-demos/iron-ore-silica-impurities/DACPAC).
5-
2. The ARM/AMD docker image files that need to be pushed to the conatiner registry can be downloaded [here](https://github.com/microsoft/sql-server-samples/tree/master/samples/demos/azure-sql-edge-demos/iron-ore-silica-impurities/tar-files).
3+
In this folder, you will find the required files to execute
4+
5+
1. The [Iron Ore Silica Impurities Demo](https://docs.microsoft.com/en-us/azure/azure-sql-edge/tutorial-deploy-azure-resources)
6+
* DACPAC or Data Tier AppliCation Package is a single file which contains database model i.e. all files represent database objects. This file can be downloaded [here](https://github.com/microsoft/sql-server-samples/tree/master/samples/demos/azure-sql-edge-demos/iron-ore-silica-impurities/DACPAC).
7+
* The ARM/AMD docker image files that need to be pushed to the conatiner registry can be downloaded [here](https://github.com/microsoft/sql-server-samples/tree/master/samples/demos/azure-sql-edge-demos/iron-ore-silica-impurities/tar-files).
8+
9+
10+
2. The [wind turbine demo](samples/demos/azure-sql-edge-demos/Wind_Turbine_Demo.zip) can be downloaded and run on your local machines

samples/features/sql-big-data-cluster/spark/data-virtualization/mssql_spark_connector_ad_pyspark.ipynb

Lines changed: 88 additions & 125 deletions
Large diffs are not rendered by default.

samples/features/sql-big-data-cluster/spark/data-virtualization/mssql_spark_connector_user_creation.ipynb

Lines changed: 101 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,32 @@
2727
"azdata_cell_guid": "4d6539fc-aa99-4cd8-a9de-357e2d6424e2"
2828
}
2929
},
30+
{
31+
"cell_type": "markdown",
32+
"source": [
33+
"## For non-AD cluster, run the following cells to prepare user and table:"
34+
],
35+
"metadata": {
36+
"azdata_cell_guid": "9642f940-770f-4bfd-85ee-e0159ccb5689"
37+
}
38+
},
3039
{
3140
"cell_type": "code",
3241
"source": [
33-
"-- Start with creating a testdatabase. \r\n",
34-
"Create DATABASE connector_test_db"
42+
"-- Create a database named \"connector_test_db\"\r\n",
43+
"IF NOT EXISTS (SELECT * FROM sys.databases WHERE name = N'connector_test_db')\r\n",
44+
"BEGIN\r\n",
45+
" Create DATABASE connector_test_db\r\n",
46+
"END\r\n",
47+
"\r\n",
48+
"-- Create a login\r\n",
49+
"IF NOT EXISTS (select name from sys.server_principals where name='connector_user')\r\n",
50+
"BEGIN\r\n",
51+
" CREATE LOGIN connector_user WITH PASSWORD ='password123!#' \r\n",
52+
"END"
3553
],
3654
"metadata": {
37-
"azdata_cell_guid": "8fdf2f56-f89d-4bf9-81be-1dfb92631251"
55+
"azdata_cell_guid": "84932473-88cd-433e-baf7-eeee178021aa"
3856
},
3957
"outputs": [
4058
{
@@ -47,37 +65,44 @@
4765
{
4866
"output_type": "display_data",
4967
"data": {
50-
"text/html": "Total execution time: 00:00:01.345"
68+
"text/html": "Total execution time: 00:00:00.335"
5169
},
5270
"metadata": {}
5371
}
5472
],
55-
"execution_count": 1
73+
"execution_count": 6
5674
},
5775
{
5876
"cell_type": "code",
5977
"source": [
60-
"Use connector_test_db;\n",
61-
"CREATE LOGIN connector_user WITH PASSWORD ='password123!#' \n",
62-
"CREATE USER connector_user FROM LOGIN connector_user\n",
63-
"\n",
64-
"-- to view data pool node configuration\n",
65-
"grant VIEW DATABASE STATE to connector_user\n",
66-
"\n",
67-
"-- To create external tables in data pools\n",
68-
"grant alter any external data source to connector_user;\n",
69-
"\n",
70-
"-- To create external table\n",
71-
"grant create table to connector_user;\n",
72-
"grant alter any schema to connector_user;\n",
73-
"\n",
74-
"\n",
75-
"\n",
76-
"ALTER ROLE [db_datareader] ADD MEMBER connector_user\n",
77-
"ALTER ROLE [db_datawriter] ADD MEMBER connector_user"
78+
"Use connector_test_db;\r\n",
79+
"\r\n",
80+
"-- Create a database user\r\n",
81+
"CREATE USER connector_user FROM LOGIN connector_user\r\n",
82+
"\r\n",
83+
"-- To view data pool node configuration\r\n",
84+
"grant VIEW DATABASE STATE to connector_user;\r\n",
85+
"\r\n",
86+
"-- To create external tables in data pools\r\n",
87+
"grant alter any external data source to connector_user;\r\n",
88+
"\r\n",
89+
"-- To create external table\r\n",
90+
"grant create table to connector_user;\r\n",
91+
"grant alter any schema to connector_user;\r\n",
92+
"\r\n",
93+
"ALTER ROLE [db_datareader] ADD MEMBER connector_user;\r\n",
94+
"ALTER ROLE [db_datawriter] ADD MEMBER connector_user;\r\n",
95+
"\r\n",
96+
"-- Create external table in data pool\r\n",
97+
"CREATE EXTERNAL DATA SOURCE connector_ds WITH (LOCATION = 'sqldatapool://controller-svc/default');\r\n",
98+
"EXECUTE('USE connector_test_db; CREATE EXTERNAL TABLE [dummy3] ([number] int, [word] nvarchar(2048)) WITH (DATA_SOURCE = connector_ds, DISTRIBUTION = ROUND_ROBIN)')\r\n",
99+
"\r\n",
100+
"-- Create a login in data pools and Provide right permissions to this user\r\n",
101+
"EXECUTE( ' Use connector_test_db; CREATE LOGIN connector_user WITH PASSWORD = ''password123!#'' ; ' ) AT DATA_SOURCE connector_ds;\r\n",
102+
"EXECUTE( ' Use connector_test_db; CREATE USER connector_user ; ALTER ROLE [db_datareader] ADD MEMBER connector_user; ALTER ROLE [db_datawriter] ADD MEMBER connector_user ;') AT DATA_SOURCE connector_ds;"
78103
],
79104
"metadata": {
80-
"azdata_cell_guid": "4dd976a3-1ed7-43d3-ad29-657fe1046fb3"
105+
"azdata_cell_guid": "8fdf2f56-f89d-4bf9-81be-1dfb92631251"
81106
},
82107
"outputs": [
83108
{
@@ -90,25 +115,39 @@
90115
{
91116
"output_type": "display_data",
92117
"data": {
93-
"text/html": "Total execution time: 00:00:00.087"
118+
"text/html": "Total execution time: 00:00:10.334"
94119
},
95120
"metadata": {}
96121
}
97122
],
98-
"execution_count": 2
123+
"execution_count": 1
124+
},
125+
{
126+
"cell_type": "markdown",
127+
"source": [
128+
"## For AD cluster, run the following cells to prepare user and table:"
129+
],
130+
"metadata": {
131+
"azdata_cell_guid": "11ea89a5-5f60-495d-864e-a80ef7a10510"
132+
}
99133
},
100134
{
101135
"cell_type": "code",
102136
"source": [
103-
"-- Add this user to a data pool user.\r\n",
104-
"Use connector_test_db;\r\n",
105-
"CREATE EXTERNAL DATA SOURCE connector_ds WITH (LOCATION = 'sqldatapool://controller-svc/default');\r\n",
106-
"EXECUTE('USE connector_test_db; CREATE EXTERNAL TABLE [dummy3] ([number] int, [word] nvarchar(2048)) WITH (DATA_SOURCE = connector_ds, DISTRIBUTION = ROUND_ROBIN)')\r\n",
137+
"-- Create a database named \"spark_mssql_db\"\r\n",
138+
"IF NOT EXISTS (SELECT * FROM sys.databases WHERE name = N'spark_mssql_db')\r\n",
139+
"BEGIN\r\n",
140+
" CREATE DATABASE spark_mssql_db\r\n",
141+
"END\r\n",
107142
"\r\n",
108-
""
143+
"-- Create a login from a domain user\r\n",
144+
"IF NOT EXISTS (select name from sys.server_principals where name='AZDATA\\testusera1')\r\n",
145+
"BEGIN\r\n",
146+
" CREATE LOGIN [AZDATA\\testusera1] FROM WINDOWS\r\n",
147+
"END"
109148
],
110149
"metadata": {
111-
"azdata_cell_guid": "0b06540d-0787-493d-aba6-83420200da14"
150+
"azdata_cell_guid": "819012ba-db8f-4c25-9606-1801f46d60e4"
112151
},
113152
"outputs": [
114153
{
@@ -121,22 +160,45 @@
121160
{
122161
"output_type": "display_data",
123162
"data": {
124-
"text/html": "Total execution time: 00:00:04.496"
163+
"text/html": "Total execution time: 00:00:10.921"
125164
},
126165
"metadata": {}
127166
}
128167
],
129-
"execution_count": 3
168+
"execution_count": 18
130169
},
131170
{
132171
"cell_type": "code",
133172
"source": [
173+
"Use spark_mssql_db;\r\n",
174+
"\r\n",
175+
"-- Create a database user\r\n",
176+
"CREATE USER [AZDATA\\testusera1];\r\n",
177+
"\r\n",
178+
"-- To view data pool node configuration\r\n",
179+
"GRANT VIEW DATABASE STATE to [AZDATA\\testusera1];\r\n",
180+
"\r\n",
181+
"-- To create external tables in data pools\r\n",
182+
"grant alter any external data source to [AZDATA\\testusera1];\r\n",
183+
"\r\n",
184+
"-- To create external table\r\n",
185+
"grant create table to [AZDATA\\testusera1];\r\n",
186+
"grant alter any schema to [AZDATA\\testusera1];\r\n",
187+
"\r\n",
188+
"ALTER ROLE [db_datareader] ADD MEMBER [AZDATA\\testusera1];\r\n",
189+
"ALTER ROLE [db_datawriter] ADD MEMBER [AZDATA\\testusera1];\r\n",
190+
"\r\n",
191+
"-- Create external table in data pool\r\n",
192+
"CREATE EXTERNAL DATA SOURCE connector_ds WITH (LOCATION = 'sqldatapool://controller-svc/default');\r\n",
193+
"EXECUTE('USE spark_mssql_db; CREATE EXTERNAL TABLE [dummy3] ([number] int, [word] nvarchar(2048)) WITH (DATA_SOURCE = connector_ds, DISTRIBUTION = ROUND_ROBIN)')\r\n",
194+
"\r\n",
134195
"-- Create a login in data pools and Provide right permissions to this user\r\n",
135-
"EXECUTE( ' Use connector_test_db; CREATE LOGIN connector_user WITH PASSWORD = ''password123!#'' ; ' ) AT DATA_SOURCE connector_ds;\r\n",
136-
"EXECUTE( ' Use connector_test_db; CREATE USER connector_user ; ALTER ROLE [db_datareader] ADD MEMBER connector_user; ALTER ROLE [db_datawriter] ADD MEMBER connector_user ;') AT DATA_SOURCE connector_ds;"
196+
"EXECUTE( ' USE spark_mssql_db; CREATE LOGIN [AZDATA\\testusera1] FROM WINDOWS ' ) AT DATA_SOURCE connector_ds;\r\n",
197+
"\r\n",
198+
"EXECUTE( ' USE spark_mssql_db; CREATE USER [AZDATA\\testusera1] ; ALTER ROLE [db_datareader] ADD MEMBER [AZDATA\\testusera1]; ALTER ROLE [db_datawriter] ADD MEMBER [AZDATA\\testusera1] ;') AT DATA_SOURCE connector_ds;"
137199
],
138200
"metadata": {
139-
"azdata_cell_guid": "5079dfe9-22e3-4a8f-919b-c6219f5a901a"
201+
"azdata_cell_guid": "2c853db3-e081-4229-a66f-5c248fb8eb0d"
140202
},
141203
"outputs": [
142204
{
@@ -149,12 +211,12 @@
149211
{
150212
"output_type": "display_data",
151213
"data": {
152-
"text/html": "Total execution time: 00:00:01.174"
214+
"text/html": "Total execution time: 00:00:10.628"
153215
},
154216
"metadata": {}
155217
}
156218
],
157-
"execution_count": 5
219+
"execution_count": 19
158220
}
159221
]
160222
}

samples/manage/sql-assessment-api/notebooks/SQLAssessmentAPIQuickStartNotebook.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@
103103
"source": [
104104
"### Learn more about SQL Assessment API\r\n",
105105
"To learn more about SQL Assesment API such as customizing and extending the rule set, saving the results in a table, etc., please visit:\r\n",
106+
"- Continue learning more about SQL Assessments with the ➡ [SQL Assessment API Tutorial notebook](https://github.com/microsoft/sql-server-samples/blob/master/samples/manage/sql-assessment-api/notebooks/SQLAssessmentAPITutorialNotebook.ipynb)\r\n",
106107
"- Docs online page: https://docs.microsoft.com/sql/sql-assessment-api/sql-assessment-api-overview \r\n",
107-
"- GitHub repo: http://aka.ms/sql-assessment-api\r\n",
108-
"- SQL Assessment API Tutorial notebook: coming soon"
108+
"- GitHub repo: http://aka.ms/sql-assessment-api"
109109
],
110110
"metadata": {
111111
"azdata_cell_guid": "180b3a6d-1dab-4641-acd4-dc319e81ef1f"

samples/manage/sql-assessment-api/notebooks/SQLAssessmentAPITutorialNotebook.ipynb

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,51 @@
331331
"outputs": [],
332332
"execution_count": 38
333333
},
334+
{
335+
"cell_type": "markdown",
336+
"source": [
337+
"### 7. Scaling up your Checks\r\n",
338+
"Running checks across multiple machines and writng their results back to the same table in SQL Server. You can keep you list of SQL Servers to check anywhere you want, in a text file, in an Excel spreadsheet, in a table you maintain yourself, the options are endless.\r\n",
339+
"\r\n",
340+
"Two options are shown below show features availabile that can be managed from SSMS or Azure Data Studio, and can accessed via the `SQLSERVER:\\` Provider, which is part of the `SqlServer` module.\r\n",
341+
"\r\n",
342+
"1. Registered Servers is feature of SSMS and stores a list of SQL Server instances in a local XML file.\r\n",
343+
"2. Central Management Server relise on a SQL Server to maintain the list of SQL Server instances (instead of a _local XML file_) and is available in both SSMS & Azure Data Studio."
344+
],
345+
"metadata": {
346+
"azdata_cell_guid": "0ad9518f-e770-4819-b4d1-7f5608c793b3"
347+
}
348+
},
349+
{
350+
"cell_type": "code",
351+
"source": [
352+
"# This approach leverages the Registered Servers feature of SSMS to obtain a list of SQL Servers, and run checks against them.\r\n",
353+
"Get-ChildItem 'SQLSERVER:\\SQLRegistration\\Database Engine Server Group' | \r\n",
354+
"Where-Object { $_.mode -ne 'd'} | \r\n",
355+
"Invoke-SqlAssessment -FlattenOutput |\r\n",
356+
"Write-SqlTableData -ServerInstance localhost -DatabaseName SQLAssessmentDemo -SchemaName Assessment -TableName Results -Force"
357+
],
358+
"metadata": {
359+
"azdata_cell_guid": "3a0c510d-07c7-464b-8b0a-2152df24e237"
360+
},
361+
"outputs": [],
362+
"execution_count": null
363+
},
364+
{
365+
"cell_type": "code",
366+
"source": [
367+
"<# This approach leverages the Central Management Server feature to obtain a list of SQL Servers #>\r\n",
368+
"Get-ChildItem 'SQLSERVER:\\SQLRegistration\\Central Management Server Group' -Recurse | \r\n",
369+
"Where-Object { $_.mode -ne 'd'} | \r\n",
370+
"Invoke-SqlAssessment -FlattenOutput |\r\n",
371+
"Write-SqlTableData -ServerInstance localhost -DatabaseName SQLAssessmentDemo -SchemaName Assessment -TableName Results -Force"
372+
],
373+
"metadata": {
374+
"azdata_cell_guid": "c6ca3196-b661-46b4-9818-502c779742ab"
375+
},
376+
"outputs": [],
377+
"execution_count": null
378+
},
334379
{
335380
"cell_type": "markdown",
336381
"source": [
@@ -612,4 +657,4 @@
612657
}
613658
}
614659
]
615-
}
660+
}

0 commit comments

Comments
 (0)