An Azure service that provides a general-purpose, serverless container platform.
Hi @AI
Thank you for reaching out to Microsoft Q&A.
Based on the details shared, the behavior you are observing is primarily due to a combination of configuration issues and a known platform/runtime behavior change that surfaced around April–May timeframe. Azure Functions (including when running on Azure Container Apps) has a strict dependency on the AzureWebJobsStorage setting for its internal operations such as trigger coordination, scaling, checkpointing, and host state management. When the setting is configured as UseDevelopmentStorage=true, this only works in local development environments where a storage emulator exists. In Azure, there is no emulator available, so the Functions host continuously attempts to reach a valid storage endpoint and retries in a loop, leading to excessive background processing and CPU usage spikes.
Although there was no officially documented platform upgrade specifically on April 23, multiple customer cases and observations indicate that runtime behavior (particularly around retry mechanisms and environment variable handling) became more aggressive or stricter during that timeframe. This made previously unnoticed misconfigurations (like invalid storage settings) start impacting CPU utilization significantly. Even after correcting the storage configuration, you are still seeing elevated CPU usage because of an additional issue involving the Functions runtime inside Azure Container Apps. Specifically, the error “Invalid URI: hostname could not be parsed” originates from the LinuxContainerMetricsPublisher component, which attempts to build a URI using the HOSTNAME environment variable. In some Container Apps environments, this variable is empty, leading to repeated exceptions every few seconds. These repeated failures contribute to continued CPU usage above baseline even though the primary storage issue is resolved. [learn.microsoft.com]
Refer below points to resolve this issue or this is the workaround:
Ensure correct AzureWebJobsStorage configuration
Make sure the application setting is pointing to a valid Azure Storage account (not local emulator). Example:
AzureWebJobsStorage = DefaultEndpointsProtocol=https;AccountName=<name>;AccountKey=<key>;EndpointSuffix=core.windows.net
OR (recommended using Managed Identity):
AzureWebJobsStorage__accountName = <storage-account-name>
This prevents continuous retry loops and eliminates the major cause of CPU spike.
Remove conflicting or deprecated storage-related settings
If you are using identity-based configuration, avoid mixing multiple settings such as:
-
AzureWebJobsStorage -
AzureWebJobsStorage__blobServiceUri
Keep only the required configuration to avoid unexpected runtime behavior and failures observed in similar cases.
Do not override platform-managed environment variables
Avoid manually setting system variables like:
HOSTNAME
Overriding these can cause revision failures or unexpected runtime issues. The “Invalid URI hostname” issue is related to platform-level handling of this variable, not application logic. [learn.microsoft.com]
Treat “Invalid URI hostname could not be parsed” as a known runtime issue
- This issue is currently a known behavior affecting Azure Functions on Container Apps
- It originates from the metrics publisher component and does not typically impact function execution
- At present, there is no confirmed public ETA for a fix, so it should be treated as a non-blocking platform issue
Reduce impact (temporary mitigation)
- Lower logging verbosity to reduce excessive logging from repeated exceptions
- Monitor Application Insights to confirm that function executions remain healthy
- Ignore the error if functionality is not impacted (until platform fix is released)
Validate CPU baseline after fixes
After correcting storage config and stabilizing runtime:
- CPU should drop significantly
- Remaining ~2x usage is expected due to platform overhead + metrics-related retries
- Continue monitoring to ensure no further abnormal spikes.