Skip to content

Commit

Permalink
Use newer API version for Azure Cost Management client (#5158)
Browse files Browse the repository at this point in the history
* Use newer API version for Azure Cost Management client

The SDK defaults to using 2022-10-01 and there is a bug with the Azure API not
properly returning data for V2 cost exports. Hopefully using the newer Azure API
will work aruond the problem while Microsoft fixes the bug on their end.

---------

Co-authored-by: Luke Couzens <[email protected]>
  • Loading branch information
samdoran and lcouzens committed Jun 10, 2024
1 parent 318dc3b commit e2f0934
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions koku/koku/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,3 +584,7 @@

# Delay Celery Tasks Timeout
DELAYED_TASK_TIME = ENVIRONMENT.int("DELAYED_TASK_TIME", default=3600)

AZURE_COST_MGMT_CLIENT_API_VERSION = ENVIRONMENT.get_value(
"AZURE_COST_MGMT_CLIENT_API_VERSION", default="2023-07-01-preview"
)
4 changes: 3 additions & 1 deletion koku/providers/azure/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
from msrestazure.azure_cloud import AZURE_PUBLIC_CLOUD
from msrestazure.azure_cloud import AZURE_US_GOV_CLOUD

from koku.settings import AZURE_COST_MGMT_CLIENT_API_VERSION


class AzureClientFactory:
"""Azure client factory.
Expand Down Expand Up @@ -59,7 +61,7 @@ def credentials(self):
@property
def cost_management_client(self):
"""Get cost management client with subscription and credentials."""
return CostManagementClient(self.credentials)
return CostManagementClient(self.credentials, api_version=AZURE_COST_MGMT_CLIENT_API_VERSION)

@property
def resource_client(self):
Expand Down

0 comments on commit e2f0934

Please sign in to comment.