Azure SQL Hybrid Cloud Toolkit Notebooks Extension Command (#13286)

* added extension folder incomplete

* WIP extension progress

* notebook finally opens in side panel

* notebook now opens via notebook extension

* html file spaces restored

* package json fixed

* fixed vscode import issue

* more cleanup

* remove git stuff

* placeholder icon logos added

* fixed gulpfile

* cleanup changes

* vscode import fixed

* fixed main and yarn.lock

* added provided notebooks view

* formatting for package.json

* removed first command as its not necessary

* fixed notebook typo

* readded spaces
This commit is contained in:
Alex Ma
2020-11-11 13:50:36 -08:00
committed by GitHub
parent b32e5f8f25
commit fa608f9f80
87 changed files with 8661 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

View File

@@ -0,0 +1,103 @@
{
"metadata": {
"kernelspec": {
"name": "powershell",
"display_name": "PowerShell"
},
"language_info": {
"name": "powershell",
"codemirror_mode": "shell",
"mimetype": "text/x-sh",
"file_extension": ".ps1"
}
},
"nbformat_minor": 2,
"nbformat": 4,
"cells": [
{
"cell_type": "markdown",
"source": [
"Migration Compatibility Assessment\n",
"=======================================================\n",
"\n",
"Description\n",
"-----------\n",
"Use this notebook to analzye an on-premises SQL Server instance or database for compatibility for migration to SQL Azure. The assessment will provide guidance on features not currently supported in Azure and remediation actions that can be taken to prepare for migration.\n",
""
],
"metadata": {
"azdata_cell_guid": "6764dd37-fb1f-400d-8f2b-70bc36fc3b61"
}
},
{
"cell_type": "markdown",
"source": [
"This notebook requires Data Migration Assistant to be installed in order to execute the below commands.\r\n",
"The installtion link would be [Data Migration Assistant download](https://www.microsoft.com/en-us/download/confirmation.aspx?id=53595)\r\n",
"\r\n",
"_With version 2.1 and above, when installation of Data Migration Assistant is successfull, it will also install dmacmd.exe in %ProgramFiles%\\Microsoft Data Migration Assistant\\. Use dmacmd.exe to assess databases in an unattended mode, and output the result to JSON or CSV file. This method is especially useful when assessing several databases or huge databases_"
],
"metadata": {
"azdata_cell_guid": "68506e39-d34b-4f17-a0c6-94e978f76488"
}
},
{
"cell_type": "code",
"source": [
"$ExecutableFile = \"\" # Path of the DmaCmd.exe file, generally the path would be \"C:\\Program Files\\Microsoft Data Migration Assistant\\DmaCmd.exe\"\r\n",
"$AssessmentName = \"\" # Name of the Assessment\r\n",
"$Server = \"\" # Targert Sql Server\r\n",
"$InitialCatalog = \"\" # Database name of the specified Sql Server\r\n",
"$ResultPath = \"\" # Path and Name of the file to store the result in json format, for example \"C:\\\\temp\\\\Results\\\\AssessmentReport.json\""
],
"metadata": {
"azdata_cell_guid": "d81972c1-3b0b-47d9-b8a3-bc5ab4001a34"
},
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"### **Single-database assessment using Windows authentication and running compatibility rules**\r\n",
"\r\n",
"This command assess the single databse using authentication as Windows and save the result in specified path.\r\n",
"It requires Sql Server name & Database name in order to assess"
],
"metadata": {
"azdata_cell_guid": "146181e8-c0e5-4fab-b4a4-40276762ff9f"
}
},
{
"cell_type": "code",
"source": [
"& $ExecutableFile /AssessmentName=$AssessmentName /AssessmentDatabases=\"Server=$Server;Initial Catalog=$InitialCatalog;Integrated Security=true\" /AssessmentEvaluateCompatibilityIssues /AssessmentOverwriteResult /AssessmentResultJson=$ResultPath"
],
"metadata": {
"azdata_cell_guid": "c3abe0ea-e971-4058-9c85-9f2d909a9291"
},
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"_Get-Content_ cmdlet gets the content of the item at the location specified by the path, such as the text in a file or the content of a function. For files, the content is read one line at a time and returns a collection of objects, each of which represents a line of content."
],
"metadata": {
"azdata_cell_guid": "4b1c8811-8b78-4543-bfa3-f4879510795b"
}
},
{
"cell_type": "code",
"source": [
"Get-Content -Path $ResultPath"
],
"metadata": {
"azdata_cell_guid": "7e69969a-0d53-4a00-830c-3ed41318234a"
},
"outputs": [],
"execution_count": null
}
]
}

View File

@@ -0,0 +1,9 @@
# Assessments
[Home](../readme.md)
## Notebooks in this Chapter
- [SQL Server Best Practices Assessment](sql-server-assessment.ipynb) - Use the SQL Server Assessment API to review the configuration of instances by name or dynamically by specifying the instance of a Central Management Server. SQL Assessment API provides a mechanism to evaluate the configuration of your SQL Server for best practices. The API is delivered with a ruleset containing best practice rules suggested by SQL Server Team. This ruleset is enhancing with the release of new versions but at the same time, the API is built with the intent to give a highly customizable and extensible solution. So, users can tune the default rules and create their own ones. SQL Assessment API is useful when you want to make sure your SQL Server configuration is in line with recommended best practices. After an initial assessment, configuration stability can be tracked by regularly scheduled assessments.
- [Compatibility Assessment](compatibility-assessment.ipynb) - Coming soon

View File

@@ -0,0 +1,194 @@
{
"metadata": {
"kernelspec": {
"name": "powershell",
"display_name": "PowerShell"
},
"language_info": {
"name": "powershell",
"codemirror_mode": "shell",
"mimetype": "text/x-sh",
"file_extension": ".ps1"
}
},
"nbformat_minor": 2,
"nbformat": 4,
"cells": [
{
"cell_type": "markdown",
"source": [
"# SQL Server Assessment Tool\n",
"\n",
"This notebook will demonstrate the use of the [SQL Server Assessment API](https://docs.microsoft.com/en-us/sql/sql-assessment-api/sql-assessment-api-overview), a tool to review the configuration of a SQL Server and Databases for best practices. An assessment is performed against a chosen SQL Server object. The default ruleset checks for two kinds of objects: Server and Database. In addition, the API supports Filegroup and AvailabilityGroup. When attempting to migrate a database from on-premise to Azure, it is recommended to fix any assessment items prior.\n",
"\n",
"**Unlike other notebooks, do not execute all cells of this notebook!** \n",
"\n",
"A single assessment may take awhile so fill out the variables and execute the cell that matches the desired environment to perform the assessment needed. Only one of these cells needs to be executed after the variables are defined.\n",
"\n",
"1. Ensure that the proper APIs and modules are installed per the <a href=\"../prereqs.ipynb\">prerequisites</a> notebook\n",
"2. Define a service instance and group corresponding to the SQL Server instances to be assessed\n",
"3. Choose an example below that corresponds to the appropriate task\n",
"4. Execute only that example's code block and wait for results\n",
"5. Fix any recommended issues and rerun Assessment API until clear"
],
"metadata": {
"azdata_cell_guid": "86ecfb01-8c38-4a99-92a8-687d8ec7f4b0"
}
},
{
"cell_type": "code",
"source": [
"$ServerInstance = \"\"\r\n",
"$Group = \"\""
],
"metadata": {
"azdata_cell_guid": "db21129e-9bda-4db9-8d61-d2b264a3cad8"
},
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"### Example 1 Get-SqlInstance\r\n",
"Pipe the output of the Get-SqlInstance cmdlet to the _Get-SqlAssessmentItem_ cmdlet to pass the instance object to it to perform an assessment on the entire instance. "
],
"metadata": {
"azdata_cell_guid": "c6f94c36-0566-4963-acb8-4a419758d26e"
}
},
{
"cell_type": "code",
"source": [
"Get-SqlInstance -ServerInstance $serverInstance | Get-SqlAssessmentItem"
],
"metadata": {
"azdata_cell_guid": "420e135e-0190-476b-812d-f716ec619ed3"
},
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"### Example 2 - Get-Item\r\n",
"Get a list of available databases in the instance using the _Get-Item_ cmdlet and pipe it to _Get-SqlAssessmentItem_. "
],
"metadata": {
"azdata_cell_guid": "30bcf8ed-cfd4-4e3b-b634-acdafab13437"
}
},
{
"cell_type": "code",
"source": [
"Get-Item SQLSERVER:\\SQL\\$serverInstance\\default | Get-SqlAssessmentItem"
],
"metadata": {
"azdata_cell_guid": "4525cbe7-719a-4cc3-8ebd-5279731c3979"
},
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"### Example 3 - Get-SqlDatabase\r\n",
"Or, use the _Get-SqlDatabase_ cmdlet without specifying a name to get a full list of database objects."
],
"metadata": {
"azdata_cell_guid": "def37aca-fe6e-48ad-9794-09fd9ba77740"
}
},
{
"cell_type": "code",
"source": [
"Get-SqlDatabase -ServerInstance $serverInstance | Get-SqlAssessmentItem"
],
"metadata": {
"azdata_cell_guid": "da57fa74-86b1-4d2f-a419-4035c10f0d3a"
},
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"### Example 4 - Export Assessment to SQL Table\r\n",
"Invoke assessment for the instance and save the results to a SQL table by piping the output of the _Get-SqlInstance_ cmdlet to the _Invoke-SqlAssessment_ cmdlet. The results are piped to the _Write-SqlTableData_ cmdlet. The _Invoke-Assessment_ cmdlet is run with the -**FlattenOutput** parameter in this example. This parameter makes the output suitable for the _Write-SqlTableData_ cmdlet. The latter raises an error if the parameter is omitted."
],
"metadata": {
"azdata_cell_guid": "aeaa588a-a3a2-4bc3-9b4b-794427b77649"
}
},
{
"cell_type": "code",
"source": [
"Get-SqlInstance -ServerInstance $serverInstance |\r\n",
"Invoke-SqlAssessment -FlattenOutput |\r\n",
"Write-SqlTableData -ServerInstance $serverInstance -DatabaseName SQLAssessmentDemo -SchemaName Assessment -TableName Results -Force"
],
"metadata": {
"azdata_cell_guid": "28ce8df2-1da8-4462-8e91-62646642d4b1"
},
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"### Example 5 - SQL Server (SSMS) Locally Registered Servers\r\n",
"To gather locally saved SQL registered servers, use the SQL Server PowerShell module installed from the [Pre-requisites notebook](..\\prereqs.ipynb). "
],
"metadata": {
"azdata_cell_guid": "3a14a231-2ab3-45db-9afa-fbd369f4ec0f"
}
},
{
"cell_type": "code",
"source": [
"Import-Module SqlServer\r\n",
"$RegisteredServers = Get-ChildItem SQLSERVER:\\SQLRegistration -Recurse | Where-Object {$_.IsLocal -eq $True}\r\n",
"$RegisteredServers.Refresh() \r\n",
"$RegisteredServers | Format-List -Property *"
],
"metadata": {
"azdata_cell_guid": "c373d5c0-3eaa-4196-8cd4-2e7d9d1896a1",
"tags": []
},
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"### Example 5 - Specifying a Central Management Server\r\n",
"Many large organizations use [Registered Servers](https://docs.microsoft.com/en-us/sql/ssms/register-servers/register-servers) to organize their networks within editors like SSMS or ADS. To take advantage of running the SQL Server Assessment API against all or a specific Registered Server Group, specify the CMS instance below. \r\n",
"\r\n",
"![](CMS.png)\r\n",
"\r\n",
"Take advantage of the [dbatools CMS module](https://dbatools.io/cms/) for this task. "
],
"metadata": {
"azdata_cell_guid": "cd3b800e-003f-432c-88aa-5738aba11378"
}
},
{
"cell_type": "code",
"source": [
"# Get a list of all servers stored on the CMS instance \r\n",
"# Note that this list is pipable to all dbatools commands\r\n",
"\r\n",
"if($SqlInstance -And $Group){\r\n",
" Get-DbaRegServer -SqlInstance $SqlInstance -Group $Group\r\n",
"}else{\r\n",
" Get-DbaRegServer -SqlInstance $SqlInstance\r\n",
"}"
],
"metadata": {
"azdata_cell_guid": "4a7bd412-5099-47b4-a737-455e01b0c172"
},
"outputs": [],
"execution_count": null
}
]
}