From ceecb276a2886799378437f8c34b85379efad39b Mon Sep 17 00:00:00 2001 From: Batuhan YILDIZ <52682703+byildiz05@users.noreply.github.com> Date: Wed, 3 Apr 2024 08:04:11 -0700 Subject: [PATCH 01/17] Adding DPS status bar chart --- .../dashboard/Arc - Server Deployment.json | 58 ++++++++++++++++++- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/samples/features/azure-arc/dashboard/Arc - Server Deployment.json b/samples/features/azure-arc/dashboard/Arc - Server Deployment.json index 5030e89f..f67b474d 100644 --- a/samples/features/azure-arc/dashboard/Arc - Server Deployment.json +++ b/samples/features/azure-arc/dashboard/Arc - Server Deployment.json @@ -678,14 +678,14 @@ }, { "name": "query", - "value": "resources\r\n | where type == \"microsoft.hybridcompute/machines\"\r\n | where properties.detectedProperties.mssqldiscovered == true\r\n | extend serverId = tolower(tostring(id))\r\n | extend serverName = name\r\n | extend serverProvisioningState = tostring(properties.provisioningState)\r\n | extend serverServerStatus = tostring(properties.status)\r\n | extend serverProcessorCount = properties.detectedProperties.processorCount\r\n | extend serverCoreCount = toint(properties.detectedProperties.coreCount)\r\n | extend serverLogicalCoreCount = toint(properties.detectedProperties.logicalCoreCount)\r\n | join kind= leftouter (\r\n resources\r\n | where type == \"microsoft.hybridcompute/machines/extensions\"\r\n | where properties.type in (\"WindowsAgent.SqlServer\",\"LinuxAgent.SqlServer\")\r\n | extend extensionId = tolower(tostring(id))\r\n | extend extensionServerId = tolower(tostring (iff(id contains \"/extensions/WindowsAgent.SqlServer\" or id contains \"/extensions/LinuxAgent.SqlServer\", substring(id, 0, indexof(id, \"/extensions/\")), \"\")))\r\n | extend extensionProvisioningState = tostring(properties.provisioningState) \r\n | extend extensionLicenseType = tostring(properties.settings.LicenseType)\r\n )\r\n on $left.serverId == $right.extensionServerId\r\n | join kind= leftouter (\r\n resources\r\n | where type == 'microsoft.azurearcdata/sqlserverinstances' \r\n | extend sqlId = tolower(tostring(id))\r\n | extend sqlServerId = tolower(tostring(properties.containerResourceId))\r\n | extend sqlName = name\r\n | extend sqlProvisioningState = tostring(properties.provisioningState)\r\n | extend sqlServerStatus = tostring(properties.status)\r\n | extend sqlVersion = tostring(properties.version)\r\n | extend sqlLicenseType = tostring(properties.licenseType)\r\n | extend sqlEdition = tostring(properties.edition)\r\n | extend sqlvcore = toint(properties.vCore)\r\n )\r\n on $left.extensionServerId == $right.sqlServerId\r\n | where isnotempty(sqlServerId)\r\n //| project sqlEdition, serverName, sqlName, sqlLicenseType, extensionLicenseType, serverCoreCount, sqlvcore\r\n | where sqlLicenseType in (\"Paid\", \"ServerCAL\")\r\n | where sqlEdition in (\"Enterprise\", \"Standard\")\r\n | summarize count(sqlName), min(serverCoreCount), sum(sqlvcore) by serverName, extensionLicenseType\r\n | summarize [\"Number of Servers\"] = count(serverName), [\"Number of SQL Servers\"] = sum(count_sqlName), \r\n [\"Number of Windows Cores\"] = sum(min_serverCoreCount), [\"Number of SQL Cores\"] = sum(sum_sqlvcore) \r\n by [\"Extension License Type\"] = extensionLicenseType", + "value": "resources\r\n | where type == \"microsoft.hybridcompute/machines\"\r\n | where properties.detectedProperties.mssqldiscovered == true\r\n | extend serverId = tolower(tostring(id))\r\n | extend serverName = name\r\n | extend serverProvisioningState = tostring(properties.provisioningState)\r\n | extend serverServerStatus = tostring(properties.status)\r\n | extend serverProcessorCount = properties.detectedProperties.processorCount\r\n | extend serverCoreCount = toint(properties.detectedProperties.coreCount)\r\n | extend serverLogicalCoreCount = toint(properties.detectedProperties.logicalCoreCount)\r\n | join kind= leftouter (\r\n resources\r\n | where type == \"microsoft.hybridcompute/machines/extensions\"\r\n | where properties.type in (\"WindowsAgent.SqlServer\",\"LinuxAgent.SqlServer\")\r\n | extend extensionId = tolower(tostring(id))\r\n | extend extensionServerId = tolower(tostring (iff(id contains \"/extensions/WindowsAgent.SqlServer\" or id contains \"/extensions/LinuxAgent.SqlServer\", substring(id, 0, indexof(id, \"/extensions/\")), \"\")))\r\n | extend extensionProvisioningState = tostring(properties.provisioningState) \r\n | extend extensionLicenseType = tostring(properties.settings.LicenseType)\r\n )\r\n on $left.serverId == $right.extensionServerId\r\n | join kind= leftouter (\r\n resources\r\n | where type == 'microsoft.azurearcdata/sqlserverinstances' \r\n | extend sqlId = tolower(tostring(id))\r\n | extend sqlServerId = tolower(tostring(properties.containerResourceId))\r\n | extend sqlName = name\r\n | extend sqlProvisioningState = tostring(properties.provisioningState)\r\n | extend sqlServerStatus = tostring(properties.status)\r\n | extend sqlVersion = tostring(properties.version)\r\n | extend sqlLicenseType = tostring(properties.licenseType)\r\n | extend sqlEdition = tostring(properties.edition)\r\n | extend sqlvcore = toint(properties.vCore)\r\n )\r\n on $left.extensionServerId == $right.sqlServerId\r\n | where isnotempty(sqlServerId)\r\n //| project sqlEdition, serverName, sqlName, sqlLicenseType, extensionLicenseType, serverCoreCount, sqlvcore\r\n | where sqlLicenseType in (\"Paid\", \"ServerCAL\")\r\n | where sqlEdition in (\"Enterprise\", \"Standard\")\r\n | summarize count(sqlName), min(serverCoreCount) by serverName, extensionLicenseType\r\n | summarize [\"Number of Servers\"] = count(serverName), [\"Number of SQL Servers\"] = sum(count_sqlName), \r\n [\"Number of Windows Cores\"] = sum(min_serverCoreCount) \r\n by [\"Extension License Type\"] = extensionLicenseType", "isOptional": true } ], "type": "Extension/HubsExtension/PartType/ArgQueryGridTile", "settings": {}, "partHeader": { - "title": "Number of Cores", + "title": "Number of Cores for Production Servers (EE/SE)", "subtitle": "SQL License in (Paid and ServerCAL)" } } @@ -1011,6 +1011,60 @@ "subtitle": "SQL Server 2014 ESU" } } + }, + "19": { + "position": { + "x": 0, + "y": 38, + "colSpan": 18, + "rowSpan": 4 + }, + "metadata": { + "inputs": [ + { + "name": "partTitle", + "value": "Query 2", + "isOptional": true + }, + { + "name": "query", + "value": "resources\r\n | where type == \"microsoft.hybridcompute/machines\"\r\n | extend serverId = tolower(tostring(id))\r\n | extend serverName = name\r\n | extend serverSubscriptionId = subscriptionId\r\n | extend serverLocation = location\r\n | extend serverResourceGroup = resourceGroup\r\n | extend serverTags = tags\r\n | extend serverProvisioningState = tostring(properties.provisioningState)\r\n | extend serverServerStatus = tostring(properties.status)\r\n | extend serverDisplayName = tostring(properties.displayName)\r\n | extend serverMssqldiscovered = properties.detectedProperties.mssqldiscovered\r\n | extend serverComputerName = tostring(properties.osProfile.computerName)\r\n | project serverId, \r\n [\"Server Name\"] = serverName, [\"Display Name\"] = serverDisplayName, [\"Computer Name\"] = serverComputerName, \r\n [\"Server State\"] = serverProvisioningState, [\"Server Status\"] = serverServerStatus, [\"MSSQL Discovered\"] = serverMssqldiscovered,\r\n [\"Subscription Id\"] = serverSubscriptionId, [\"Location\"] = serverLocation, [\"Resource Group\"] = serverResourceGroup, [\"Server Tags\"] = serverTags\r\n | join kind= leftouter (\r\n resources\r\n | where type == \"microsoft.hybridcompute/machines/extensions\"\r\n | where properties.type in (\"WindowsAgent.SqlServer\",\"LinuxAgent.SqlServer\")\r\n | extend extensionId = tolower(tostring(id))\r\n | extend extensionServerId = tolower(tostring (iff(id contains \"/extensions/WindowsAgent.SqlServer\" or id contains \"/extensions/LinuxAgent.SqlServer\", \r\n substring(id, 0, indexof(id, \"/extensions/\")), \r\n \"\")))\r\n | extend extensionProvisioningState = tostring(properties.provisioningState) \r\n | extend extensionType = tostring(properties.type)\r\n | extend extensionVersion = properties.instanceView.typeHandlerVersion\r\n | parse properties with * 'SQL Server Extension Agent: ' sqlAgentStatus ';' *\r\n | parse properties with * 'uploadStatus : ' uploadStatus ';' *\r\n | extend extensionSQLAgentStatus = iff(isnotempty(sqlAgentStatus),sqlAgentStatus,\"Unhealthy\")\r\n | extend extensionUploadStatus = iff(isnotempty(uploadStatus),uploadStatus,\"Missing SQL Agent\")\r\n | extend extensionLicenseType = tostring(properties.settings.LicenseType)\r\n | project extensionId, extensionServerId,\r\n [\"Extension State\"] = extensionProvisioningState, [\"SQLExtension Status\"] = extensionSQLAgentStatus, [\"DPS Status\"] = extensionUploadStatus, \r\n [\"Extension Name\"] = extensionType, [\"Extension Version\"] = extensionVersion,\r\n [\"Extension License\"] = extensionLicenseType\r\n )\r\n on $left.serverId == $right.extensionServerId\r\n | summarize uploadStatusBreakdown = count() by [\"DPS Status\"]", + "isOptional": true + }, + { + "name": "chartType", + "value": 1, + "isOptional": true + }, + { + "name": "isShared", + "isOptional": true + }, + { + "name": "queryId", + "value": "", + "isOptional": true + }, + { + "name": "formatResults", + "isOptional": true + }, + { + "name": "queryScope", + "value": { + "scope": 0, + "values": [] + }, + "isOptional": true + } + ], + "type": "Extension/HubsExtension/PartType/ArgQueryChartTile", + "settings": {}, + "partHeader": { + "title": "Data Processing Service (DPS) Status", + "subtitle": "" + } + } } } } From 1b584fd130de8e58c89bc2e54e8aee0ef92d2da8 Mon Sep 17 00:00:00 2001 From: Adam Turner Date: Thu, 4 Apr 2024 10:35:07 -0500 Subject: [PATCH 02/17] Update README.md Updated parameter value in readme.md - spelling of LicenseType did not match parameter in underlying PowerShell script. --- .../azure-arc-enabled-sql-server/modify-license-type/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/manage/azure-arc-enabled-sql-server/modify-license-type/README.md b/samples/manage/azure-arc-enabled-sql-server/modify-license-type/README.md index ba1674ba..e0282d40 100644 --- a/samples/manage/azure-arc-enabled-sql-server/modify-license-type/README.md +++ b/samples/manage/azure-arc-enabled-sql-server/modify-license-type/README.md @@ -30,7 +30,7 @@ The script accepts the following command line parameters: |-SubId|subscription_id *or* a file_name|Optional: Subscription id or a .csv file with the list of subscriptions1. If not specified all subscriptions will be scanned| |-ResourceGroup |resource_group_name|Optional: Limits the scope to a specific resource group| |-MachineName |machine_name|Optional: Limits the scope to a specific machine| -|-LicenceType | "Paid", "PAYG" or "LicenseOnly"| Optional: Sets the license type to the specified value | +|-LicenseType | "Paid", "PAYG" or "LicenseOnly"| Optional: Sets the license type to the specified value | |-EnableESU | "Yes", "No" | Optional. Enables the ESU policy the value is "Yes" or disables it if the value is "No". To enable, the license type must be "Paid" or "PAYG"| |-Force| |Optional. Forces the change of the license type to the specified value on all installed extensions. If -Force is not specified, the -LicenseType value is set only if undefined. Ignored if -LicenseType is not specified| From e157b26eeb5cf9c4e91b287b82f34c2bb8f42099 Mon Sep 17 00:00:00 2001 From: Batuhan YILDIZ <52682703+byildiz05@users.noreply.github.com> Date: Fri, 5 Apr 2024 08:50:25 -0700 Subject: [PATCH 03/17] Adding a descriptive message to a table --- .../features/azure-arc/dashboard/Arc - Server Deployment.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/features/azure-arc/dashboard/Arc - Server Deployment.json b/samples/features/azure-arc/dashboard/Arc - Server Deployment.json index f67b474d..a6033ae8 100644 --- a/samples/features/azure-arc/dashboard/Arc - Server Deployment.json +++ b/samples/features/azure-arc/dashboard/Arc - Server Deployment.json @@ -685,7 +685,7 @@ "type": "Extension/HubsExtension/PartType/ArgQueryGridTile", "settings": {}, "partHeader": { - "title": "Number of Cores for Production Servers (EE/SE)", + "title": "Number of Cores for Production Servers Only (EE/SE)", "subtitle": "SQL License in (Paid and ServerCAL)" } } From 6d36fce3f6473fbb015b75e9f5903b88ab61fc85 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 11 Apr 2024 10:43:00 +0000 Subject: [PATCH 04/17] Bump tar Bumps [tar](https://github.com/isaacs/node-tar) from 6.1.15 to 6.2.1. - [Release notes](https://github.com/isaacs/node-tar/releases) - [Changelog](https://github.com/isaacs/node-tar/blob/main/CHANGELOG.md) - [Commits](https://github.com/isaacs/node-tar/compare/v6.1.15...v6.2.1) --- updated-dependencies: - dependency-name: tar dependency-type: indirect ... Signed-off-by: dependabot[bot] --- .../SqlDbEdgeDemo.Web/ClientApp/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/demos/azure-sql-edge-demos/Wind Turbine Demo/webappsrc/SqlDbEdgeDemoWeb/SqlDbEdgeDemo.Web/ClientApp/package-lock.json b/samples/demos/azure-sql-edge-demos/Wind Turbine Demo/webappsrc/SqlDbEdgeDemoWeb/SqlDbEdgeDemo.Web/ClientApp/package-lock.json index 1245a383..76a6dc20 100644 --- a/samples/demos/azure-sql-edge-demos/Wind Turbine Demo/webappsrc/SqlDbEdgeDemoWeb/SqlDbEdgeDemo.Web/ClientApp/package-lock.json +++ b/samples/demos/azure-sql-edge-demos/Wind Turbine Demo/webappsrc/SqlDbEdgeDemoWeb/SqlDbEdgeDemo.Web/ClientApp/package-lock.json @@ -12762,9 +12762,9 @@ "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==" }, "tar": { - "version": "6.1.15", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.15.tgz", - "integrity": "sha512-/zKt9UyngnxIT/EAGYuxaMYgOIJiP81ab9ZfkILq4oNLPFX50qyYmu7jRj9qeXoxmJHjGlbH0+cm2uy1WCs10A==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", "requires": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", From 65329d58baed92ea6549ba625cdb784c09ae5bf8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 11 Apr 2024 20:00:44 +0000 Subject: [PATCH 05/17] Bump Azure.Identity Bumps [Azure.Identity](https://github.com/Azure/azure-sdk-for-net) from 1.10.2 to 1.11.0. - [Release notes](https://github.com/Azure/azure-sdk-for-net/releases) - [Commits](https://github.com/Azure/azure-sdk-for-net/compare/Azure.Identity_1.10.2...Azure.Identity_1.11.0) --- updated-dependencies: - dependency-name: Azure.Identity dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- .../features/security/ledger/source/ContosoHR/ContosoHR.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/features/security/ledger/source/ContosoHR/ContosoHR.csproj b/samples/features/security/ledger/source/ContosoHR/ContosoHR.csproj index 99d038b7..99e6ed65 100644 --- a/samples/features/security/ledger/source/ContosoHR/ContosoHR.csproj +++ b/samples/features/security/ledger/source/ContosoHR/ContosoHR.csproj @@ -43,7 +43,7 @@ - + From 373617ca3fc8b9ec2e22d87daa397820f7f134d4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 11 Apr 2024 20:00:51 +0000 Subject: [PATCH 06/17] Bump Azure.Identity Bumps [Azure.Identity](https://github.com/Azure/azure-sdk-for-net) from 1.10.2 to 1.11.0. - [Release notes](https://github.com/Azure/azure-sdk-for-net/releases) - [Commits](https://github.com/Azure/azure-sdk-for-net/compare/Azure.Identity_1.10.2...Azure.Identity_1.11.0) --- updated-dependencies: - dependency-name: Azure.Identity dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- .../source/ContosoHR/ContosoHR.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/features/security/always-encrypted-with-secure-enclaves/source/ContosoHR/ContosoHR.csproj b/samples/features/security/always-encrypted-with-secure-enclaves/source/ContosoHR/ContosoHR.csproj index a078da12..cd12b121 100644 --- a/samples/features/security/always-encrypted-with-secure-enclaves/source/ContosoHR/ContosoHR.csproj +++ b/samples/features/security/always-encrypted-with-secure-enclaves/source/ContosoHR/ContosoHR.csproj @@ -15,8 +15,8 @@ - - + + From 592145c197ec2ba83305291a67694c1f80c32161 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 11 Apr 2024 20:38:55 +0000 Subject: [PATCH 07/17] Bump Azure.Identity Bumps [Azure.Identity](https://github.com/Azure/azure-sdk-for-net) from 1.10.4 to 1.11.0. - [Release notes](https://github.com/Azure/azure-sdk-for-net/releases) - [Commits](https://github.com/Azure/azure-sdk-for-net/compare/Azure.Identity_1.10.4...Azure.Identity_1.11.0) --- updated-dependencies: - dependency-name: Azure.Identity dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- .../AlwaysEncryptedConsole/AlwaysEncryptedConsole.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/features/security/always-encrypted-with-secure-enclaves/sample-application/AlwaysEncryptedConsole/AlwaysEncryptedConsole.csproj b/samples/features/security/always-encrypted-with-secure-enclaves/sample-application/AlwaysEncryptedConsole/AlwaysEncryptedConsole.csproj index cc585632..8bd770b7 100644 --- a/samples/features/security/always-encrypted-with-secure-enclaves/sample-application/AlwaysEncryptedConsole/AlwaysEncryptedConsole.csproj +++ b/samples/features/security/always-encrypted-with-secure-enclaves/sample-application/AlwaysEncryptedConsole/AlwaysEncryptedConsole.csproj @@ -11,7 +11,7 @@ - + From 2e28d8643fe3183335285674c1d49e0c4c50a0df Mon Sep 17 00:00:00 2001 From: Sven Aelterman <17446043+SvenAelterman@users.noreply.github.com> Date: Fri, 19 Apr 2024 21:27:18 -0500 Subject: [PATCH 08/17] Fix typos Instasnces -> Instances --- .../azure-arc/dashboard/Arc - SQL Server Inventory.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/features/azure-arc/dashboard/Arc - SQL Server Inventory.json b/samples/features/azure-arc/dashboard/Arc - SQL Server Inventory.json index a171f5c1..03fb8669 100644 --- a/samples/features/azure-arc/dashboard/Arc - SQL Server Inventory.json +++ b/samples/features/azure-arc/dashboard/Arc - SQL Server Inventory.json @@ -731,7 +731,7 @@ }, "partHeader": { "title": "SQL Server Instances by Location", - "subtitle": "SQL Servers instasnces by \"Location\" tag values" + "subtitle": "SQL Servers instances by \"Location\" tag values" } } }, @@ -785,7 +785,7 @@ "content": {} }, "partHeader": { - "title": "SQL Server Instasnces by Data Center", + "title": "SQL Server Instances by Data Center", "subtitle": "SQL Servers instances by \"Datacenter\" tag values." } } From 21b4c74977e324e910c1c6482dea275d272155d9 Mon Sep 17 00:00:00 2001 From: Scott Petersen Date: Mon, 29 Apr 2024 15:30:07 -0500 Subject: [PATCH 09/17] Added section: Servers with Errors communicating with Azure DPS Service --- .../dashboard/SQL Server Instances.json | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/samples/features/azure-arc/dashboard/SQL Server Instances.json b/samples/features/azure-arc/dashboard/SQL Server Instances.json index 6845ef6a..886cc071 100644 --- a/samples/features/azure-arc/dashboard/SQL Server Instances.json +++ b/samples/features/azure-arc/dashboard/SQL Server Instances.json @@ -741,6 +741,60 @@ "subtitle": "" } } + }, + "14": { + "position": { + "x": 0, + "y": 30, + "colSpan": 19, + "rowSpan": 4 + }, + "metadata": { + "inputs": [ + { + "name": "partTitle", + "value": "Query 1", + "isOptional": true + }, + { + "name": "chartType", + "isOptional": true + }, + { + "name": "isShared", + "isOptional": true + }, + { + "name": "queryId", + "isOptional": true + }, + { + "name": "formatResults", + "isOptional": true + }, + { + "name": "queryScope", + "value": { + "scope": 0, + "values": [] + }, + "isOptional": true + }, + { + "name": "query", + "value": "resources\r\n | where type =~ 'microsoft.hybridcompute/machines/extensions'\r\n | where properties.type in ('WindowsAgent.SqlServer','LinuxAgent.SqlServer')\r\n | parse id with * '/providers/Microsoft.HybridCompute/machines/' machineName '/extensions/' *\r\n | parse properties with * 'uploadStatus : ' uploadStatus ';' *\r\n | project uploadStatus, subscriptionId, resourceGroup, machineName\r\n | where uploadStatus !in ('OK') //comment this out to see all upload stats\r\n | order by uploadStatus desc", + "isOptional": true + } + ], + "type": "Extension/HubsExtension/PartType/ArgQueryGridTile", + "settings": { + "content": {} + }, + "partHeader": { + "title": "Servers with Errors communicating with Azure DPS Service", + "subtitle": "For more information see https://learn.microsoft.com/en-us/sql/sql-server/azure-arc/troubleshoot-telemetry-endpoint" + } + } } } } From 09647386dd192e93eae2cd3c5675b7880a5953d1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 May 2024 04:13:26 +0000 Subject: [PATCH 10/17] Bump ejs Bumps [ejs](https://github.com/mde/ejs) from 3.1.8 to 3.1.10. - [Release notes](https://github.com/mde/ejs/releases) - [Commits](https://github.com/mde/ejs/compare/v3.1.8...v3.1.10) --- updated-dependencies: - dependency-name: ejs dependency-type: indirect ... Signed-off-by: dependabot[bot] --- .../SqlDbEdgeDemo.Web/ClientApp/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/demos/azure-sql-edge-demos/Wind Turbine Demo/webappsrc/SqlDbEdgeDemoWeb/SqlDbEdgeDemo.Web/ClientApp/package-lock.json b/samples/demos/azure-sql-edge-demos/Wind Turbine Demo/webappsrc/SqlDbEdgeDemoWeb/SqlDbEdgeDemo.Web/ClientApp/package-lock.json index 76a6dc20..5dc1f9f1 100644 --- a/samples/demos/azure-sql-edge-demos/Wind Turbine Demo/webappsrc/SqlDbEdgeDemoWeb/SqlDbEdgeDemo.Web/ClientApp/package-lock.json +++ b/samples/demos/azure-sql-edge-demos/Wind Turbine Demo/webappsrc/SqlDbEdgeDemoWeb/SqlDbEdgeDemo.Web/ClientApp/package-lock.json @@ -4937,9 +4937,9 @@ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" }, "ejs": { - "version": "3.1.8", - "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.8.tgz", - "integrity": "sha512-/sXZeMlhS0ArkfX2Aw780gJzXSMPnKjtspYZv+f3NiKLlubezAHDU5+9xz6gd3/NhG3txQCo6xlglmTS+oTGEQ==", + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz", + "integrity": "sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA==", "requires": { "jake": "^10.8.5" } From 5bfe458854f8a80b22efad2b71590e13857a0bdd Mon Sep 17 00:00:00 2001 From: Alex Talarico <3521183+getalex@users.noreply.github.com> Date: Wed, 15 May 2024 21:36:18 -0400 Subject: [PATCH 11/17] Updated logging logic and format to CSV (ssrs_migration.rss) Added header to generated CSV log file enhancements to logging output generated, color scheme updates. --- .../ssrs-migration-rss/ssrs_migration.rss | 43 +++++++++++++------ 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/samples/features/reporting-services/ssrs-migration-rss/ssrs_migration.rss b/samples/features/reporting-services/ssrs-migration-rss/ssrs_migration.rss index ac675037..49164e10 100644 --- a/samples/features/reporting-services/ssrs-migration-rss/ssrs_migration.rss +++ b/samples/features/reporting-services/ssrs-migration-rss/ssrs_migration.rss @@ -75,7 +75,7 @@ Private policies As Policy() = Nothing Private srcSiteUrl As String = Nothing Private snkSiteUrl As String = Nothing -Private logFilePath As String = "MigrationLog.txt" +Private logFilePath As String = "MigrationLog.csv" '''''''''''''''''''''''''''''''''''''''''''''' Sub Main() @@ -241,8 +241,8 @@ Sub Main() RsSnk.CreateFolder(folderName, parentFolder, Nothing) Catch er As Exception If (er.Message.Contains("Microsoft.ReportingServices.Diagnostics.Utilities.ItemAlreadyExistsException")) - Console.ForegroundColor = ConsoleColor.Yellow - Console.WriteLine("Folder already exists.") + Console.ForegroundColor = ConsoleColor.Gray + Console.WriteLine("Folder already exists: " + folderName) Console.ResetColor() Else Throw ' Unknown Exception @@ -478,7 +478,7 @@ Function MigrateDataSource(srcItem As CatalogItem) As CatalogItem Console.WriteLine(warningMsg) Console.ResetColor() - LogErrorToFile("CATALOGITEM", "Warning", warningMsg) + LogErrorToFile("CATALOGITEM", "Warning: " + result.Path, warningMsg) End If @@ -567,7 +567,7 @@ Function MigrateCatalogItem(srcItem As CatalogItem) As CatalogItem Console.WriteLine(warningMsg) Console.ResetColor() - LogErrorToFile("CATALOGITEM", "Warning", warningMsg) + LogErrorToFile("CATALOGITEM", "Warning: " + result.TypeName, warningMsg) End If End If Next @@ -742,7 +742,7 @@ Sub MigrateReportSubscriptions(snkReport As CatalogItem, srcReport As CatalogIte Console.Write(description) If Not dataRetrievalPlan Is Nothing And TypeOf dataRetrievalPlan.Item Is DataSourceReference Then Dim item As DataSourceReference = dataRetrievalPlan.Item - Dim ref As String = GetSnkPath(item.Reference) + Dim ref As String = GetSnkPathRef(item.Reference) item.Reference = ref End If RsSnk.CreateDataDrivenSubscription(snkReport.Path, extensionSettings, dataRetrievalPlan, description, eventType, GetMatchData(matchData, RsSnk), parameters) @@ -756,7 +756,7 @@ Sub MigrateReportSubscriptions(snkReport As CatalogItem, srcReport As CatalogIte Console.WriteLine(warningMsg) Console.ResetColor() - LogErrorToFile("SUBSCRIPTIONS", "Warning", warningMsg) + LogErrorToFile("SUBSCRIPTIONS", "Warning: " + snkReport.Path, warningMsg) End If End If @@ -795,9 +795,9 @@ Sub MigrateReportSubscriptions(snkReport As CatalogItem, srcReport As CatalogIte Console.WriteLine(warningMsg) Console.ResetColor() - LogErrorToFile("SUBSCRIPTIONS", "Warning", warningMsg) + LogErrorToFile("SUBSCRIPTIONS", "Warning: " + snkReport.Path, warningMsg) - End If + End If Next Catch ex As Exception @@ -990,10 +990,19 @@ End Sub 'Helper function to link snk reference with relative paths Function GetSnkPathRef(srcPath As String) As String - Dim snkPath = srcPath - If srcSiteUrl isNot Nothing - snkPath = srcPath.Remove(0, srcSiteUrl.LastIndexOf("/")) - End If + Dim snkPath = srcPath + + If Not SrcIsNative Then + 'SharePoint integrated mode, will assume /sites server relative URL delimeter + If srcSiteUrl isNot Nothing + Dim delimeter = "/sites/" + snkPath = srcPath.Remove(0, srcSiteUrl.IndexOf(delimeter) + delimeter.Length-1) + End If + Else + 'Treat path reference like other scenarios if not intergated mode + snkPath = GetSnkPath(srcPath) + End If + Return snkPath End Function @@ -1189,12 +1198,18 @@ Sub LogErrorToFile(source As String, errItem as String, message As String) Dim writer as StreamWriter Try + Dim fileExists As Boolean = Not File.Exists(logFilePath) OrElse New FileInfo(logFilePath).Length = 0 + ' Create a StreamWriter object writer = New StreamWriter(logFilePath, True) + If fileExists Then + writer.WriteLine("DateTime, Source, ErrorItem, ErrorMessage") + End If + ' Format log message with timestamp Dim timeStamp As String = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") - Dim formattedMessage as String = String.Format("{0}, {1}, {2}, ""{3}""", timeStamp, source, errItem, message.Replace(Environment.NewLine, "")) + Dim formattedMessage as String = String.Format("{0}, {1}, {2}, ""{3}""", timeStamp, source, errItem, message.Replace(Environment.NewLine, " ")) ' Write the log entry to file writer.WriteLine(formattedMessage) From ca425596f3df435ff2e669f9ef477f053090ce6f Mon Sep 17 00:00:00 2001 From: Monem Date: Sat, 18 May 2024 01:13:59 +0300 Subject: [PATCH 12/17] fix wwi-ssis package file: "DailyETLMain.dtsx" --- .../wwi-ssis/wwi-ssis/DailyETLMain.dtsx | 6253 ++++++++++++++++- 1 file changed, 6252 insertions(+), 1 deletion(-) diff --git a/samples/databases/wide-world-importers/wwi-ssis/wwi-ssis/DailyETLMain.dtsx b/samples/databases/wide-world-importers/wwi-ssis/wwi-ssis/DailyETLMain.dtsx index e3a97158..796d73cf 100644 --- a/samples/databases/wide-world-importers/wwi-ssis/wwi-ssis/DailyETLMain.dtsx +++ b/samples/databases/wide-world-importers/wwi-ssis/wwi-ssis/DailyETLMain.dtsx @@ -6829,4 +6829,6255 @@ WITH RESULT SETS WITH RESULT SETS ( ( - [WWI Stock Item ID] int, \ No newline at end of file + [WWI Stock Item ID] int, + [Stock Item] nvarchar(100), + Color nvarchar(20), + [Selling Package] nvarchar(50), + [Buying Package] nvarchar(50), + Brand nvarchar(50), + Size nvarchar(20), + [Lead Time Days] int, + [Quantity Per Outer] int, + [Is Chiller Stock] bit, + Barcode nvarchar(50), + [Tax Rate] decimal(18,3), + [Unit Price] decimal(18,2), + [Recommended Retail Price] decimal(18,2), + [Typical Weight Per Unit] decimal(18,3), + Photo varbinary(max), + [Valid From] datetime2(7), + [Valid To] datetime2(7) + ) +); + + 1252 + false + 2 + "@LastCutoff:Input",{60BD9010-4784-49A6-8FF2-340D7AB3B70D};"@NewCutoff:Input",{B96D08A3-EC4E-45C1-8E78-526920753C6B}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + [Integration].[StockItem_Staging] + + + 1252 + false + 3 + false + false + CHECK_CONSTRAINTS + 2147483647 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + EXEC Integration.GetSupplierUpdates ?, ? +WITH RESULT SETS +( + ( + [WWI Supplier ID] int, + Supplier nvarchar(100), + Category nvarchar(50), + [Primary Contact] nvarchar(50), + [Supplier Reference] nvarchar(20), + [Payment Days] int, + [Postal Code] nvarchar(10), + [Valid From] datetime2(7), + [Valid To] datetime2(7) + ) +); + + 1252 + false + 2 + "@LastCutoff:Input",{60BD9010-4784-49A6-8FF2-340D7AB3B70D};"@NewCutoff:Input",{B96D08A3-EC4E-45C1-8E78-526920753C6B}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + [Integration].[Supplier_Staging] + + + 1252 + false + 3 + false + false + CHECK_CONSTRAINTS + 2147483647 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + EXEC Integration.GetTransactionUpdates ?, ? +WITH RESULT SETS +( + ( + [Date Key] date, + [WWI Customer Transaction ID] int, + [WWI Supplier Transaction ID] int, + [WWI Invoice ID] int, + [WWI Purchase Order ID] int, + [Supplier Invoice Number] nvarchar(20), + [Total Excluding Tax] decimal(18,2), + [Tax Amount] decimal(18,2), + [Total Including Tax] decimal(18,2), + [Outstanding Balance] decimal(18,2), + [Is Finalized] bit, + [WWI Customer ID] int, + [WWI Bill To Customer ID] int, + [WWI Supplier ID] int, + [WWI Transaction Type ID] int, + [WWI Payment Method ID] int, + [Last Modified When] datetime2(7) + ) +); + + 1252 + false + 2 + "@LastCutoff:Input",{60BD9010-4784-49A6-8FF2-340D7AB3B70D};"@NewCutoff:Input",{B96D08A3-EC4E-45C1-8E78-526920753C6B}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + [Integration].[Transaction_Staging] + + + 1252 + false + 3 + false + false + CHECK_CONSTRAINTS + 2147483647 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + EXEC Integration.GetTransactionTypeUpdates ?, ? +WITH RESULT SETS +( + ( + [WWI Transaction Type ID] int, + [Transaction Type] nvarchar(50), + [Valid From] datetime2(7), + [Valid To] datetime2(7) + ) +); + + 1252 + false + 2 + "@LastCutoff:Input",{60BD9010-4784-49A6-8FF2-340D7AB3B70D};"@NewCutoff:Input",{B96D08A3-EC4E-45C1-8E78-526920753C6B}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + [Integration].[TransactionType_Staging] + + + 1252 + false + 3 + false + false + CHECK_CONSTRAINTS + 2147483647 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DataSourceViewID + + + TableInfoObjectType + Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DataSourceViewID + + + TableInfoObjectType + Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DataSourceViewID + + + TableInfoObjectType + Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DataSourceViewID + + + TableInfoObjectType + Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DataSourceViewID + + + TableInfoObjectType + Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DataSourceViewID + + + TableInfoObjectType + Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DataSourceViewID + + + TableInfoObjectType + Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DataSourceViewID + + + TableInfoObjectType + Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DataSourceViewID + + + TableInfoObjectType + Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DataSourceViewID + + + TableInfoObjectType + Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DataSourceViewID + + + TableInfoObjectType + Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DataSourceViewID + + + TableInfoObjectType + Table + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DataSourceViewID + + + TableInfoObjectType + Table + + + +]]> + \ No newline at end of file From 6aa81f36a7c8edaeebb344f67337572a52aa9adf Mon Sep 17 00:00:00 2001 From: "Masha Thomas (MSFT)" <32783170+MashaMSFT@users.noreply.github.com> Date: Wed, 22 May 2024 11:29:19 -0700 Subject: [PATCH 13/17] Add files via upload --- samples/manage/sql-vm-throttling-analysis.ps1 | 186 ++++++++++++++++++ 1 file changed, 186 insertions(+) create mode 100644 samples/manage/sql-vm-throttling-analysis.ps1 diff --git a/samples/manage/sql-vm-throttling-analysis.ps1 b/samples/manage/sql-vm-throttling-analysis.ps1 new file mode 100644 index 00000000..5a653929 --- /dev/null +++ b/samples/manage/sql-vm-throttling-analysis.ps1 @@ -0,0 +1,186 @@ +# Prompt user for details +$subscriptionId = Read-Host "Enter Subscription ID" +$resourceGroup = Read-Host "Enter Resource Group Name" +$vmName = Read-Host "Enter VM Name" + +# Set resource details +$resourceType = "Microsoft.Compute/virtualMachines" +$resourceId = "/subscriptions/$subscriptionId/resourceGroups/$resourceGroup/providers/$resourceType/$vmName" + +# Get Azure access token +$accessToken = az account get-access-token --query accessToken -o tsv + +# Function to invoke Azure Monitor Metrics API +function Get-Metrics { + [CmdletBinding()] + param ( + [string]$accessToken, + [string]$resourceId, + [string]$metricNames, + [string]$apiVersion = "2023-10-01" + ) + try { + $startTime = (Get-Date).AddHours(-24).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ') + $endTime = (Get-Date).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ') + $timespan = "$startTime/$endTime" + Write-Verbose "Evaluating timespan: $timespan" + $uri = "https://management.azure.com$resourceId/providers/Microsoft.Insights/metrics?api-version=$apiVersion&metricnames=$metricNames&aggregation=maximum&interval=PT1M×pan=$timespan" + $headers = @{ "Authorization" = "Bearer $accessToken"; "Content-Type" = "application/json" } + + $response = Invoke-RestMethod -Uri $uri -Headers $headers -Method Get + if ($response) { + Write-Verbose "API response successfully retrieved." + return $response + } else { + Write-Error "No response from API." + } + } catch { + Write-Error "Error retrieving metrics: $_" + } +} + +# Function to check if Data Disk Latency data is violating thresholds +function Check-Latency { + [CmdletBinding()] + param ( + [Parameter(Mandatory = $true)] + [Object]$metrics, + + [Parameter()] + [int]$latencyThreshold = 500, + + [Parameter()] + [int]$consecutiveCount = 5 + ) + $violationTimes = @() + foreach ($metric in $metrics.value) { + if ($metric.name.value -eq "Data Disk Latency") { + $count = 0 + foreach ($dataPoint in $metric.timeseries[0].data) { + if ($dataPoint.maximum -gt $latencyThreshold) { + $count++ + if ($count -ge $consecutiveCount) { + $violationTimes += $dataPoint.timeStamp + $count = 0 # Reset count after recording a violation + } + } else { + $count = 0 # Reset count if the sequence is broken + } + } + } + } + if ($violationTimes.Count -gt 0) { + Write-Verbose "Latency violations detected." + return @{ "Flag" = $true; "Times" = $violationTimes } + } else { + Write-Verbose "No latency violations detected." + return @{ "Flag" = $false } + } +} + +# Function to check metrics other than Latency and evaluate if they are throttled +function Check-OtherMetricsThrottled { + [CmdletBinding()] + param ( + [Parameter(Mandatory = $true)] + [Object]$metrics, + + [Parameter()] + [int]$PercentageThreshold = 90, + + [Parameter()] + [int]$consecutiveCount = 5 + ) + $violatedMetrics = @() + foreach ($metric in $metrics.value) { + $count = 0 + foreach ($dataPoint in $metric.timeseries[0].data) { + if ($dataPoint.maximum -gt $PercentageThreshold) { + $count++ + if ($count -ge $consecutiveCount) { + $violatedMetrics += @{ "Metric" = $metric.name.localizedValue; "Time" = $dataPoint.timeStamp; "Value" = $dataPoint.maximum } + break + } + } else { + $count = 0 + } + } + } + if ($violatedMetrics.Count -gt 0) { + Write-Verbose "Other metrics violations detected." + } else { + Write-Verbose "No other metrics violations detected." + } + return $violatedMetrics +} + +# Function to compare the times for Latency Metric & other Throttled Metrics. Logs Violations with Values & Timestamps +function CompareTimes { + [CmdletBinding()] + param ( + [Parameter(Mandatory = $true)] + [Hashtable]$latencyResult, + + [Parameter(Mandatory = $true)] + [Array]$otherMetrics + ) + foreach ($metric in $otherMetrics) { + $otherDateTime = [DateTime]$metric["Time"] + $isWithinFiveMinutes = $false + $closestLatencyTime = $null + $closestTimeDifference = [int]::MaxValue + + foreach ($latencyTime in $latencyResult.Times) { + $latencyDateTime = [DateTime]$latencyTime + $timeDifference = [Math]::Abs(($otherDateTime - $latencyDateTime).TotalMinutes) + + if ($timeDifference -le 5) { + $isWithinFiveMinutes = $true + if ($timeDifference -lt $closestTimeDifference) { + $closestTimeDifference = $timeDifference + $closestLatencyTime = $latencyTime + } + } + } + + if ($isWithinFiveMinutes) { + if ($otherDateTime -lt $closestLatencyTime) { + Write-Host "`n $($metric["Metric"]) limit was hit before latency spiked at $closestLatencyTime with value $($metric["Value"]). `n" + } else { + Write-Host "`n $($metric["Metric"]) hit its limit with value $($metric["Value"]) at $($metric["Time"])." + Write-Host "Latency spiked at $closestLatencyTime before $($metric["Metric"]) hit its limit `n" + } + } else { + Write-Host "`n Metric: $($metric["Metric"]) exceeded its threshold with a value of $($metric["Value"]) at $($metric["Time"]), but this was not within 5 minutes of any latency spikes." + } + } +} + +# Prompt user for latency threshold +$latencyThreshold = Read-Host "Enter Latency Threshold (default is 500)" +if (-not [int]::TryParse($latencyThreshold, [ref]0)) { + $latencyThreshold = 500 # Use default if invalid input + Write-Host "No valid input provided. Using Default 500ms for disk latency threshold" +} + +# Main Logic Execution: +$latencyMetrics = Get-Metrics -accessToken $accessToken -resourceId $resourceId -metricNames "Data Disk Latency" +$latencyResult = Check-Latency -metrics $latencyMetrics -latencyThreshold $latencyThreshold + +if ($latencyResult.Flag) { + + # Only if Latency is flagged we will check for other metrics. If no disk latency is experienced, machine is likely not throttled but only at high consumption + Write-Verbose "Checking the following metrics: Data Disk Bandwidth Consumed Percentage,Data Disk IOPS Consumed Percentage,VM Cached Bandwidth Consumed Percentage,VM Cached IOPS Consumed Percentage,VM Uncached Bandwidth Consumed Percentage,VM Uncached IOPS Consumed Percentage" + + $DiskVMMetrics = Get-Metrics -accessToken $accessToken -resourceId $resourceId -metricNames "Data Disk Bandwidth Consumed Percentage,Data Disk IOPS Consumed Percentage,VM Cached Bandwidth Consumed Percentage,VM Cached IOPS Consumed Percentage,VM Uncached Bandwidth Consumed Percentage,VM Uncached IOPS Consumed Percentage" + + $additionalMetrics = Check-OtherMetricsThrottled -metrics $DiskVMMetrics + + if ($additionalMetrics.Count -gt 0) { + CompareTimes $latencyResult $additionalMetrics + } else { + Write-Host "No metrics violations detected besides latency." + } +} else { + Write-Host "No latency issues detected." +} From 308136be11e7614304b10f740575afab90182cfe Mon Sep 17 00:00:00 2001 From: "Masha Thomas (MSFT)" <32783170+MashaMSFT@users.noreply.github.com> Date: Wed, 22 May 2024 11:35:17 -0700 Subject: [PATCH 14/17] Update and rename sql-vm-throttling-analysis.ps1 to sql-vm-io-analysis.ps1 updating name --- .../{sql-vm-throttling-analysis.ps1 => sql-vm-io-analysis.ps1} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename samples/manage/{sql-vm-throttling-analysis.ps1 => sql-vm-io-analysis.ps1} (100%) diff --git a/samples/manage/sql-vm-throttling-analysis.ps1 b/samples/manage/sql-vm-io-analysis.ps1 similarity index 100% rename from samples/manage/sql-vm-throttling-analysis.ps1 rename to samples/manage/sql-vm-io-analysis.ps1 From f9eb783e6077a9fdb936ffb341abf8a19214a5b0 Mon Sep 17 00:00:00 2001 From: "Masha Thomas (MSFT)" <32783170+MashaMSFT@users.noreply.github.com> Date: Wed, 22 May 2024 12:16:20 -0700 Subject: [PATCH 15/17] Update sql-vm-io-analysis.ps1 --- samples/manage/sql-vm-io-analysis.ps1 | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/samples/manage/sql-vm-io-analysis.ps1 b/samples/manage/sql-vm-io-analysis.ps1 index 5a653929..9f019525 100644 --- a/samples/manage/sql-vm-io-analysis.ps1 +++ b/samples/manage/sql-vm-io-analysis.ps1 @@ -1,7 +1,7 @@ -# Prompt user for details -$subscriptionId = Read-Host "Enter Subscription ID" -$resourceGroup = Read-Host "Enter Resource Group Name" -$vmName = Read-Host "Enter VM Name" +# Enter parameters +$subscriptionId = Read-Host "" +$resourceGroup = Read-Host "" +$vmName = Read-Host "" # Set resource details $resourceType = "Microsoft.Compute/virtualMachines" @@ -10,7 +10,7 @@ $resourceId = "/subscriptions/$subscriptionId/resourceGroups/$resourceGroup/prov # Get Azure access token $accessToken = az account get-access-token --query accessToken -o tsv -# Function to invoke Azure Monitor Metrics API +# Invoke Azure Monitor Metrics API function Get-Metrics { [CmdletBinding()] param ( @@ -39,7 +39,7 @@ function Get-Metrics { } } -# Function to check if Data Disk Latency data is violating thresholds +# Check if data disk latency violates thresholds function Check-Latency { [CmdletBinding()] param ( @@ -78,7 +78,7 @@ function Check-Latency { } } -# Function to check metrics other than Latency and evaluate if they are throttled +# Check metrics other than latency to evaluate for throttling function Check-OtherMetricsThrottled { [CmdletBinding()] param ( @@ -114,7 +114,7 @@ function Check-OtherMetricsThrottled { return $violatedMetrics } -# Function to compare the times for Latency Metric & other Throttled Metrics. Logs Violations with Values & Timestamps +# Compare times for latency & other throttled metrics. Logs the volations with values & timestamps function CompareTimes { [CmdletBinding()] param ( @@ -163,13 +163,13 @@ if (-not [int]::TryParse($latencyThreshold, [ref]0)) { Write-Host "No valid input provided. Using Default 500ms for disk latency threshold" } -# Main Logic Execution: +# Execute main logic $latencyMetrics = Get-Metrics -accessToken $accessToken -resourceId $resourceId -metricNames "Data Disk Latency" $latencyResult = Check-Latency -metrics $latencyMetrics -latencyThreshold $latencyThreshold if ($latencyResult.Flag) { - # Only if Latency is flagged we will check for other metrics. If no disk latency is experienced, machine is likely not throttled but only at high consumption + # If latency is flagged, check for other metrics. If there is no disk latency, machine is likely not throttled but only at high consumption Write-Verbose "Checking the following metrics: Data Disk Bandwidth Consumed Percentage,Data Disk IOPS Consumed Percentage,VM Cached Bandwidth Consumed Percentage,VM Cached IOPS Consumed Percentage,VM Uncached Bandwidth Consumed Percentage,VM Uncached IOPS Consumed Percentage" $DiskVMMetrics = Get-Metrics -accessToken $accessToken -resourceId $resourceId -metricNames "Data Disk Bandwidth Consumed Percentage,Data Disk IOPS Consumed Percentage,VM Cached Bandwidth Consumed Percentage,VM Cached IOPS Consumed Percentage,VM Uncached Bandwidth Consumed Percentage,VM Uncached IOPS Consumed Percentage" From b03edd99d03b977bce7104f557b5ed649051e1b7 Mon Sep 17 00:00:00 2001 From: Sergio Govoni Date: Thu, 23 May 2024 15:01:05 +0200 Subject: [PATCH 16/17] Cosmetic care on README.md --- .../manage/polybase/external-table/README.md | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/samples/manage/polybase/external-table/README.md b/samples/manage/polybase/external-table/README.md index 412fb4ae..1e8e3ea4 100644 --- a/samples/manage/polybase/external-table/README.md +++ b/samples/manage/polybase/external-table/README.md @@ -1,9 +1,9 @@ ![](https://github.com/microsoft/sql-server-samples/blob/master/media/solutions-microsoft-logo-small.png) -# Handling Update Statistics Error on External Tables in SQL Server +# Handling UPDATE STATISTICS error on SQL Server PolyBase external tables -This sample describes an option to update statistics on SQL Server PolyBase external tables! +This sample describes an option to update statistics on SQL Server PolyBase external tables. ## Background @@ -37,7 +37,7 @@ The object Update Statistics isn't supported on External Table ## About this sample - **Applies to:** SQL Server 2017 (or higher) -- **Key features:** Update statistics +- **Key features:** UPDATE STATISTICS - **Workload:** No workload related to this sample - **Programming Language:** T-SQL - **Authors:** [Sergio Govoni](https://www.linkedin.com/in/sgovoni/) | [Microsoft MVP Profile](https://mvp.microsoft.com/mvp/profile/c7b770c0-3c9a-e411-93f2-9cb65495d3c4) | [Blog](https://segovoni.medium.com/) | [GitHub](https://github.com/segovoni) | [Twitter](https://twitter.com/segovoni) @@ -60,19 +60,19 @@ Upon investigation, it became apparent that SQL Server does not support the dire ## Resolution steps -1. Understanding the Limitation: +### Understanding the Limitation Referring to the documentation page, it explicitly states, "Updating statistics is not supported on external tables. To update statistics on an external table, drop and re-create the statistics." -2. Available Solutions: +### Available Solutions -Option 1: Ignore External Tables: -This option is not feasible for maintenance plans managed by SQL Server Management Studio, necessitating third-party solutions. +* Option 1: Ignore External Tables: + * This option is not feasible for maintenance plans managed by SQL Server Management Studio, necessitating third-party solutions. -Option 2: Drop and Recreate Statistics: -Employ a stored procedure, `sp_drop_create_stats_external_table`, to generate T-SQL statements for dropping and creating statistics on external tables. This procedure supports statistics on multiple columns. +* Option 2: Drop and Recreate Statistics: + * Employ a stored procedure, `sp_drop_create_stats_external_table`, to generate T-SQL statements for dropping and creating statistics on external tables. This procedure supports statistics on multiple columns. -3. Implementation Guide: +### Implementation Guide - Execute `sp_drop_create_stats_external_table` to generate T-SQL statements - Execute DROP STATISTICS statements before the maintenance statistics task @@ -106,4 +106,4 @@ This code sample is provided for demonstration and educational purposes only. It ## Related Links -For more information, see these articles... \ No newline at end of file +For more information, see these articles... From 1c11b10d600a3ed74319180a5b3f19e32b581ada Mon Sep 17 00:00:00 2001 From: Sergio Govoni Date: Thu, 23 May 2024 15:08:53 +0200 Subject: [PATCH 17/17] Add related links --- samples/manage/polybase/external-table/README.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/samples/manage/polybase/external-table/README.md b/samples/manage/polybase/external-table/README.md index 1e8e3ea4..c8c49f51 100644 --- a/samples/manage/polybase/external-table/README.md +++ b/samples/manage/polybase/external-table/README.md @@ -9,7 +9,7 @@ This sample describes an option to update statistics on SQL Server PolyBase exte In the process of configuring a maintenance plan for a SQL Server database with external tables and external data sources for PolyBase queries, an error occurred during the update statistics task. -## Problem Encountered +## Problem encountered While attempting to update statistics on an external table, the following error message was encountered: @@ -60,11 +60,11 @@ Upon investigation, it became apparent that SQL Server does not support the dire ## Resolution steps -### Understanding the Limitation +### Understanding the limitation Referring to the documentation page, it explicitly states, "Updating statistics is not supported on external tables. To update statistics on an external table, drop and re-create the statistics." -### Available Solutions +### Available solutions * Option 1: Ignore External Tables: * This option is not feasible for maintenance plans managed by SQL Server Management Studio, necessitating third-party solutions. @@ -72,7 +72,7 @@ Referring to the documentation page, it explicitly states, "Updating statistics * Option 2: Drop and Recreate Statistics: * Employ a stored procedure, `sp_drop_create_stats_external_table`, to generate T-SQL statements for dropping and creating statistics on external tables. This procedure supports statistics on multiple columns. -### Implementation Guide +### Implementation guide - Execute `sp_drop_create_stats_external_table` to generate T-SQL statements - Execute DROP STATISTICS statements before the maintenance statistics task @@ -103,7 +103,11 @@ This code sample is provided for demonstration and educational purposes only. It -## Related Links +## Related links -For more information, see these articles... +For more information, see these articles: + +- [Data virtualization with PolyBase in SQL Server](https://learn.microsoft.com/sql/relational-databases/polybase/polybase-guide?WT.mc_id=DP-MVP-4029181) +- [UPDATE STATISTICS (Transact-SQL)](https://learn.microsoft.com/sql/t-sql/statements/update-statistics-transact-sql?WT.mc_id=DP-MVP-4029181) +- [External tables: Why create statistics?](https://learn.microsoft.com/answers/questions/978155/external-tables-why-create-statistics?WT.mc_id=DP-MVP-4029181)