Azure - Reference
This section documents the current Azure FOCUS workflow modules used by eraXplor.
Main Application Module
Entry Point
Azure service package for the eraXplor FOCUS workflow.
This package exposes the Azure CLI entry point implemented in
core.services.azure.__main__ and the supporting utility modules under
core.services.azure.utils.
main()
Orchestrates and manages dependencies of Azure FOCUS export workflow.
Source code in src/core/services/azure/__main__.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
This is the primary script responsible for orchestrating the user workflow. It handles user input, invokes Azure cost data retrieval, and manages data export functionality.
Utility Modules
Banner Utilities
Shared utility helpers for eraXplor service packages.
banner()
Generates a banner and copyright notice for the eraXplor application.
Creates an ASCII art banner using the 'slant' font with the application name, along with a formatted copyright notice containing version information and contact details.
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
callable
|
A tuple containing two strings: - banner_format (str): ASCII art banner with the text "eraXplor" - copyright_notice (str): Formatted copyright and version information |
Example
banner_format, copyright_notice = banner() print(banner_format) print(copyright_notice)
Note
The copyright year is currently set to 2025 and should be updated annually. The version number reflects the current release version of the eraXplor package.
Source code in src/core/services/utils/banner_utils.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
Responsible for rendering styled ASCII banners and displaying copyright information used in the CLI interface.
Cost Export Utilities
Utility functions for configuring Azure FOCUS exports.
This module contains helper functions for: - Azure authentication - Building Azure Cost Management export payloads - Creating scheduled FOCUS exports in Parquet format
build_export_payload(storage_resource_id, container_name, folder_name, granularity='Monthly')
Build the request payload for Azure FOCUS export creation.
The payload configures: - FOCUS cost dataset - Scheduled export (recurrence matches granularity) - Parquet output format - Destination storage container and folder
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
storage_resource_id
|
str
|
Azure Storage Account resource ID. |
required |
container_name
|
str
|
Blob container name. |
required |
folder_name
|
str
|
Root folder path for exported files. |
required |
granularity
|
str
|
Dataset granularity. One of "Hourly", "Daily", or "Monthly". Defaults to "Monthly". |
'Monthly'
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: JSON payload for Azure export API request. |
Source code in src/core/services/azure/utils/azure_focus_export_utils.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
create_focus_export(billing_account_id, billing_profile_id, subscription_id, resource_group_name, storage_account_name, container_name, folder_name, granularity='Monthly', export_name='focus-cost-export')
Create an Azure Cost Management FOCUS export.
This function authenticates to Azure, builds the required export configuration, and creates a scheduled FOCUS export that writes Parquet files into the specified Azure Storage container.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
billing_account_id
|
str
|
Azure billing account identifier. |
required |
billing_profile_id
|
str
|
Azure billing profile identifier. |
required |
subscription_id
|
str
|
Azure subscription ID. |
required |
resource_group_name
|
str
|
Resource group containing storage account. |
required |
storage_account_name
|
str
|
Destination storage account name. |
required |
container_name
|
str
|
Blob container name. |
required |
folder_name
|
str
|
Folder path inside container. |
required |
export_name
|
str
|
Export job name. Defaults to "focus-cost-export". |
'focus-cost-export'
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: Result containing: - status_code (int): HTTP response code. - data (dict[str, Any]): Parsed API response. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If Azure API request fails. |
Source code in src/core/services/azure/utils/azure_focus_export_utils.py
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | |
get_billing_accounts()
Return billing accounts available to the authenticated Azure identity.
Source code in src/core/services/azure/utils/azure_focus_export_utils.py
84 85 86 87 88 89 90 91 92 93 | |
get_billing_profiles(billing_account_id)
Return billing profiles for a given Azure billing account.
Source code in src/core/services/azure/utils/azure_focus_export_utils.py
96 97 98 99 100 101 102 103 104 105 | |
get_default_billing_account_and_profile_ids()
Fetch the first available billing account and profile IDs for the authenticated credential.
Source code in src/core/services/azure/utils/azure_focus_export_utils.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
Contains helpers for discovering Azure billing identifiers and creating Azure FOCUS export definitions.
Resource Provisioning Utilities
Module for installing dependencies required for Azure FOCUS data export.
This module provides functions to create necessary Azure resources for FOCUS data export, including: - Resource Group - Storage Account - Blob Container - Folder (Virtual Directory) within the Blob Container
ARGS: - subscription_id: Azure Subscription ID - resource_group_name: Name of the Resource Group to create - location: Azure region for the resources - storage_account_name: Name of the Storage Account to create - container_name: Name of the Blob Container to create - folder_name: Name of the Folder (Virtual Directory) to create within the Blob Container
Dependencies: - azure-identity - azure-mgmt-storage - azure-mgmt-resource - azure-storage-blob
create_resource_group(subscription_id, resource_group_name='focus-data-export-rg', location='eastus')
Creates a resource group if it does not exist.
Source code in src/core/services/azure/utils/azure_focus_depends.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
create_storage_account_container_folder(subscription_id, resource_group_name='focus-data-export-rg', location='eastus', storage_account_name='focusdataexportstorage', container_name='focus-data', folder_name='focus-exports')
Creates storage account, container, and folder (virtual directory).
Source code in src/core/services/azure/utils/azure_focus_depends.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
Creates the Azure resource group, storage account, container, and folder required by the export workflow.
Export Configuration Utilities
Utility functions for configuring Azure FOCUS exports.
This module contains helper functions for: - Azure authentication - Building Azure Cost Management export payloads - Creating scheduled FOCUS exports in Parquet format
build_export_payload(storage_resource_id, container_name, folder_name, granularity='Monthly')
Build the request payload for Azure FOCUS export creation.
The payload configures: - FOCUS cost dataset - Scheduled export (recurrence matches granularity) - Parquet output format - Destination storage container and folder
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
storage_resource_id
|
str
|
Azure Storage Account resource ID. |
required |
container_name
|
str
|
Blob container name. |
required |
folder_name
|
str
|
Root folder path for exported files. |
required |
granularity
|
str
|
Dataset granularity. One of "Hourly", "Daily", or "Monthly". Defaults to "Monthly". |
'Monthly'
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: JSON payload for Azure export API request. |
Source code in src/core/services/azure/utils/azure_focus_export_utils.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
create_focus_export(billing_account_id, billing_profile_id, subscription_id, resource_group_name, storage_account_name, container_name, folder_name, granularity='Monthly', export_name='focus-cost-export')
Create an Azure Cost Management FOCUS export.
This function authenticates to Azure, builds the required export configuration, and creates a scheduled FOCUS export that writes Parquet files into the specified Azure Storage container.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
billing_account_id
|
str
|
Azure billing account identifier. |
required |
billing_profile_id
|
str
|
Azure billing profile identifier. |
required |
subscription_id
|
str
|
Azure subscription ID. |
required |
resource_group_name
|
str
|
Resource group containing storage account. |
required |
storage_account_name
|
str
|
Destination storage account name. |
required |
container_name
|
str
|
Blob container name. |
required |
folder_name
|
str
|
Folder path inside container. |
required |
export_name
|
str
|
Export job name. Defaults to "focus-cost-export". |
'focus-cost-export'
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: Result containing: - status_code (int): HTTP response code. - data (dict[str, Any]): Parsed API response. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If Azure API request fails. |
Source code in src/core/services/azure/utils/azure_focus_export_utils.py
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | |
get_billing_accounts()
Return billing accounts available to the authenticated Azure identity.
Source code in src/core/services/azure/utils/azure_focus_export_utils.py
84 85 86 87 88 89 90 91 92 93 | |
get_billing_profiles(billing_account_id)
Return billing profiles for a given Azure billing account.
Source code in src/core/services/azure/utils/azure_focus_export_utils.py
96 97 98 99 100 101 102 103 104 105 | |
get_default_billing_account_and_profile_ids()
Fetch the first available billing account and profile IDs for the authenticated credential.
Source code in src/core/services/azure/utils/azure_focus_export_utils.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
Contains the helpers that discover billing identifiers and create Azure FOCUS export definitions.
Fetch Utilities
Module for fetching Parquet files from Azure Blob Storage for FOCUS data export. This module provides a function to download Parquet files from a specified folder (virtual directory) within an Azure Blob Storage container.
ARGS: - storage_account_name: Name of the Storage Account - container_name: Name of the Blob Container - folder_name: Name of the Folder (Virtual Directory) within the Blob Container
Dependencies: - azure-identity - azure-storage-blob
download_parquet_files(storage_account_name, container_name, folder_name)
Downloads Parquet files from Azure Blob Storage
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
- storage_account_name
|
Name of the Storage Account |
required | |
- container_name
|
Name of the Blob Container |
required | |
- folder_name
|
Name of the Folder (Virtual Directory) within the Blob Container |
required |
Returns:
| Type | Description |
|---|---|
list
|
|
Source code in src/core/services/azure/utils/azure_focus_fetch.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
Provides functionality for downloading generated Parquet export files from the configured Azure Storage container.