This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <# | |
| .SYNOPSIS | |
| Tests Power BI API throttling behavior across service principal profiles. | |
| .DESCRIPTION | |
| 1. Authenticates with a service principal (client credentials). | |
| 2. Creates two service principal profiles via the Power BI Profiles API. | |
| 3. Calls the Get Datasets API using Profile 1 until throttled N times consecutively. | |
| 4. Switches to Profile 2 and tests whether the request succeeds without throttling. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| param( | |
| [Parameter(Mandatory=$true)] | |
| [string]$ReportId, | |
| [Parameter(Mandatory=$false)] | |
| [string]$BearerToken | |
| ) | |
| # Prompt for token if not provided | |
| if ([string]::IsNullOrEmpty($BearerToken)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $filteredPolicies = New-Object System.Collections.ArrayList | |
| $policies = Get-AzResource -ResourceType "Microsoft.Network/networkIntentPolicies" | |
| foreach ($policy in $policies) { | |
| $Id = $policy.ResourceId | |
| $response = Invoke-AzRestMethod -Method "GET" -Uri "https://management.azure.com$($Id)?api-version=2021-02-01" | |
| $responseObj = $response.Content | ConvertFrom-Json | |
| $policyInfo = [PSCustomObject]@{ Id = $responseObj.id; Subnet = ""; Orphaned = $false; } | |
| if ($responseObj.properties.PSObject.Properties.Match("subnets").Count -gt 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Param( | |
| [Parameter(Mandatory=$false)] | |
| [string]$subscriptionID = "YourSubscriptionIDHere", | |
| [Parameter(Mandatory=$false)] | |
| [ValidateSet("suspend", "resume")] | |
| [string]$operation = "suspend", | |
| [Parameter(Mandatory=$false)] | |
| [string]$suspendAPIVersion = "api-version=2023-11-01" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| select | |
| db_name(database_id) as database_name, | |
| [size_in_MiB] = CAST([size] * 8 / 1024.0 AS DECIMAL(10,2)), | |
| CASE | |
| WHEN CAST([size] * 8 / 1024.0 AS DECIMAL(10,2)) <= 132096 THEN 500 -- If less than or equal to 129 GiB | |
| WHEN CAST([size] * 8 / 1024.0 AS DECIMAL(10,2)) > 132096 AND CAST([size] * 8 / 1024.0 AS DECIMAL(10,2)) <= 525312 THEN 2300 -- If more than 129 GiB but less than or equal to 513 GiB | |
| WHEN CAST([size] * 8 / 1024.0 AS DECIMAL(10,2)) > 525312 AND CAST([size] * 8 / 1024.0 AS DECIMAL(10,2)) <= 1049600 THEN 5000 -- if more than 513 GiB but less than 1025 GiB | |
| ELSE 7500 -- Any more than 1025 GiB and you get 7500 | |
| END as file_iops | |
| from sys.master_files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE EVENT SESSION [FailedQueries] ON SERVER | |
| ADD EVENT sqlserver.error_reported | |
| (ACTION(sqlserver.client_app_name, sqlserver.client_hostname, | |
| sqlserver.database_name, sqlserver.sql_text, sqlserver.username) | |
| WHERE ([package0].[greater_than_int64]([severity], (10)) AND client_app_name='SQLExternalMonitoring')) | |
| WITH (STARTUP_STATE = ON) | |
| GO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| resources | |
| | where type == "microsoft.sql/servers/databases" or type == "microsoft.sql/managedinstances" or type == "microsoft.sql/servers/elasticpools" | |
| | where properties.licenseType == "LicenseIncluded" | |
| | extend SqlEdition = case(sku.name hasprefix_cs "GP_", "Standard", sku.name hasprefix_cs "HS_", "Standard", sku.name hasprefix_cs "BC_", "Enterprise", "Unknown") | |
| | extend vCores = toint(sku.capacity) | |
| | extend licensesNeeded = toint(round(vCores/2)) | |
| | project licensesNeeded, vCores, SqlEdition | |
| | summarize sum(licensesNeeded) by SqlEdition |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $allRecommendations = New-Object -TypeName "System.Collections.ArrayList" | |
| Get-AzSubscription | ForEach-Object { | |
| $sub = $_ | |
| Set-AzContext -SubscriptionId $_.Id | |
| $recommendations = Get-AzSqlServer | Get-AzSqlDatabase | Where-Object Edition -ne "System" | Get-AzSqlDatabaseSensitivityRecommendation | |
| $recommendations | ForEach-Object { | |
| $dbinfo = $_ | |
| $_.SensitivityLabels | ForEach-Object { | |
| $newRecommandation = $_ | Select-Object @{label = 'SubscriptionId'; expression = {$sub.Id}}, @{label = 'ResourceGroupName'; expression = {$dbinfo.ResourceGroupName}}, @{label = 'ServerName'; expression = {$dbinfo.ServerName}}, @{label = 'DatabaseName'; expression = {$dbinfo.DatabaseName}}, * | |
| $allRecommendations.Add($newRecommandation) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| resources | |
| | where type == "microsoft.hybridcompute/machines" | |
| | where properties.osName == "windows" | |
| | extend joinId = tolower(id) | |
| | join kind = leftouter ( | |
| resources | |
| | where type == "microsoft.azurearcdata/sqlserverinstances" | |
| | extend arcMachineId = tolower(tostring(properties.containerResourceId)) | |
| | extend sqlVersion = tostring(properties.version) | |
| | extend vCores = toint(properties.vCore) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "contentVersion": "1.0.0.0", | |
| "parameters": { | |
| "workbookDisplayName": { | |
| "type": "string", | |
| "defaultValue": "SQL Licensing Summary", | |
| "metadata": { | |
| "description": "The friendly name for the workbook that is used in the Gallery or Saved List. This name must be unique within a resource group." | |
| } | |
| }, |
NewerOlder