FlexReports - Azure Resource Groups casing
search cancel

FlexReports - Azure Resource Groups casing

book

Article ID: 393811

calendar_today

Updated On:

Products

CloudHealth

Issue/Introduction

Within FlexReports built off of the Azure cost managed dataset you will find that resource groups are returned in both upper and lower case. 


Cause

This is due to a limitation in the Microsoft API that is utilized to pull down billing data currently see - Are resource group names case sensitive? - "When using various APIs to retrieve the name for a resource or resource group, the returned value may have different casing than what you originally specified for the name." 

Resolution

  1. To work around this issue you can make use of the Lower function within FlexReporting documented here - Supported SQL Functions and Features

  2. The function needs to be applied both within the SELECT portion of the statement and the GROUP by portion of the statement see example below -

    {
    "sqlStatement" : 
     " SELECT
    	timeInterval_Month AS Month,
    	lower(ResourceGroup) AS ResourceGroup
    FROM
    	AZURE_COST_USAGE
    GROUP BY
    	timeInterval_Month,
    	lower(ResourceGroup) ",
    
    "needBackLinkingForTags" : true ,
    "dataGranularity" : "MONTHLY" ,
    "timeRange" : {
      "last": 3
    } ,
    "limit" : -1
    }


  3. Once applied you should only see one instance of the Resource Group name in lower case. Rather than both an upper case, and lower case variant of the Resource Group name.