Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AHB Workbook Incorrect SQL DB information #450

Closed
arjenhuitema opened this issue Nov 14, 2023 · 4 comments · Fixed by #451
Closed

AHB Workbook Incorrect SQL DB information #450

arjenhuitema opened this issue Nov 14, 2023 · 4 comments · Fixed by #451
Assignees
Labels
Status: 🔬 Code review Issue is currently in code review with open PRs Tool: Workbooks Azure Monitor workbooks Type: Bug 🐛 Something isn't working
Milestone

Comments

@arjenhuitema
Copy link
Contributor

arjenhuitema commented Nov 14, 2023

🐛 Problem

Elastic pool databases dont have the License Type property on the database itself, but rather on the Elastic Pool, as such they show up incorrectly in the result

👣 Repro steps

  1. Create two SQL DB on two separate Elastic pools
  2. Enable AHB on one of the two
  3. Review the query results. Both database are reported as AHB Enabled.

🤔 Expected

Expect the databases to report their AHB correctly. Also it would be great that the results are divided into 3 categories. Enabled, Disabled and Not Applicable.

📷 Screenshots

Both databases show as enabled:

Screenshot showing both databases with AHB enabled

Pool1 is enabled and Pool 2 is disabled

Screenshot showing AHB enabled on Pool1 and disabled on Pool2

ℹ️ Additional context

This issue happens because:

  1. Elastic pool databases dont have the License Type property on the database itself, but rather on the Elastic Pool
  2. The License Type property is passed to a string, in this case the property doesnt exist so it creates an empty string. Later the has statement in the Case looks for the value "LicenseIncluded", since both AHB enabled SQL DBs and Elastics DBs show empty values they are marked as AHB enabled.

Example of how the query could look like:

Resources
| where type =~ 'microsoft.sql/servers/databases'
| project databaseId = id, databaseName = name, elasticPoolId = tolower(tostring(properties.elasticPoolId)), databaseLicenseType = tostring(properties.licenseType), databaseKind = tostring(kind), subscriptionId
| join kind=leftouter (
    Resources
    | where type =~ 'microsoft.sql/servers/elasticpools'
    | project elasticPoolId = tolower(id), elasticPoolName = name, elasticPoolLicenseType = tostring(properties.licenseType), elasticPoolKind = tostring(kind))
    on elasticPoolId
| project-away elasticPoolId1
| where databaseName != 'master'
| extend AHUBState = case(
['databaseKind'] !has 'vcore' or ['databaseKind'] has 'serverless', "Not Applicable",
['databaseKind'] has 'vcore' and databaseLicenseType has 'LicenseIncluded' or elasticPoolLicenseType has 'LicenseIncluded', "Not Enabled", "Enabled"
)
| summarize count() by subscriptionId, AHUBState

Screenshot showing the results of the query. 1 database with AHB enabled, 1 Disabled and 1 Not Applicable

🙋‍♀️ Ask for the community

We could use your help:

  1. Please vote this issue up (👍) to prioritize it.
  2. Leave comments to help us solidify the vision.
@arjenhuitema arjenhuitema added Type: Bug 🐛 Something isn't working Needs: Triage 🔍 Untriaged issue needs to be reviewed Tool: Workbooks Azure Monitor workbooks labels Nov 14, 2023
Copy link

Uh oh! @arjenhuitema, the image you shared is missing helpful alt text. Check your issue body.

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.

@arthurclares arthurclares assigned sebassem and unassigned flanakin Nov 16, 2023
@arthurclares
Copy link
Collaborator

@sebassem Can you please work on this one? @arjenhuitema Thank you for the code!

@flanakin flanakin removed the Needs: Triage 🔍 Untriaged issue needs to be reviewed label Nov 29, 2023
@sebassem sebassem linked a pull request Nov 29, 2023 that will close this issue
@flanakin flanakin added the Status: 🔬 Code review Issue is currently in code review with open PRs label Dec 4, 2023
@flanakin flanakin added this to the 0.1.2 milestone Dec 4, 2023
@naseemhira1196
Copy link

Hi, just looking for an update: Were we able to fix this bug?

@sebassem
Copy link
Contributor

Yes this was shipped as part of the November release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: 🔬 Code review Issue is currently in code review with open PRs Tool: Workbooks Azure Monitor workbooks Type: Bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants