diff --git a/usage_function/README.md b/usage_function/README.md index 9331820..d84b8c8 100644 --- a/usage_function/README.md +++ b/usage_function/README.md @@ -5,6 +5,6 @@ It will get all the usage data for subscriptions in a management group or billin `costmanagement` is also an Azure function. It should be deployed to the same function app as the `usage` function. -`monthly_usage` uses similar code as `usage` but runs on the 7th day of each month to get the previous month's usage. +`monthly_usage` uses similar code as `usage` but runs bi-hourly on the 7th and 8th day of each month to get the previous month's usage. See the docs for more. diff --git a/usage_function/monthly_usage/__init__.py b/usage_function/monthly_usage/__init__.py index 5df8b0e..166e449 100644 --- a/usage_function/monthly_usage/__init__.py +++ b/usage_function/monthly_usage/__init__.py @@ -93,9 +93,9 @@ def main(mytimer: func.TimerRequest) -> None: try: usage_items = retrieve_usage(usage_query) - isodate = datetime.now().isoformat() + today = date.today() for usage_item in usage_items: - usage_item.monthly_upload = isodate + usage_item.monthly_upload = today logger.warning("Sending usage for %s", dates) send_usage(config.API_URL, usage_items, monthly_usage_upload=True)