8000
Skip to content

Fix 2253: Surface x-ms-* headers and ODataV4 errors on Azure failures - #2344

Draft
zunyangc wants to merge 2 commits into
ansible-collections:devfrom
zunyangc:2253-fix
Draft

Fix 2253: Surface x-ms-* headers and ODataV4 errors on Azure failures#2344
zunyangc wants to merge 2 commits into
ansible-collections:devfrom
zunyangc:2253-fix

Conversation

@zunyangc
Copy link
Copy Markdown
Collaborator
SUMMARY

Fix #2253.
azure_rm_resource_info now surfaces Azure's x-ms-request-id, x-ms-correlation-request-id, the full response-header dict, and the ODataV4 error body (code, message, target, details, innererror) on failure. A new fail_azure helper on AzureRMModuleBase provides the same structured failure payload for every module, and the previously-nonfunctional log_mode and log_path module arguments now attach a rotating, mode-0o600 debug log at log_path with a per-invocation correlation_id.

ISSUE TYPE
  • New Feature Pull Request
  • New Module Pull Request
  • Bug Fix Pull Request
  • Test Fix Pull Request
  • Migration Pull Request
  • Documentation Pull Request
COMPONENT NAME
  • plugins/modules/azure_rm_resource_info.py
  • plugins/module_utils/azure_rm_common.py
  • plugins/module_utils/azure_rm_common_rest.py
  • plugins/doc_fragments/azure.py
ADDITIONAL INFORMATION
  • azure_rm_resource_info failures now include correlation_id, response_metadata.{status_code,reason,request_id,correlation_request_id,http_headers}, and error.{code,message,target,details,innererror} (cited: azure.core.exceptions.HttpResponseError and ODataV4Format public shape in Azure/azure-sdk-for-python).
  • AzureRMModuleBase.fail_azure(exception, msg=None, **kwargs) is available for every module to route azure.core.exceptions.HttpResponseError (and 8000 AzureError) into a structured failure payload with redacted sensitive headers.
  • GenericRestClient.on_error fallback now raises azure.core.exceptions.HttpResponseError(response=response) instead of SendRequestException, preserving the HttpResponse object so headers survive to the caller; the unreferenced SendRequestException class is removed.
  • log_mode gains real semantics: normal (default, unchanged behavior), file (attaches a SecureRotatingFileHandler at log_path — mode 0o600, 10 MB × 5 backups), and debug (raises the azure.azcollection logger level to DEBUG). Auto-elevates to DEBUG when Ansible is invoked with -vvv or when AZURE_LOG_LEVEL is set to a standard level.
  • Every module invocation now generates a UUID4 correlation_id that appears in the log file and in fail_azure failure payloads for cross-record traceability.
  • AzureRMModuleBase.log() and AzureRMAuth.log() now emit through the azure.azcollection named logger in addition to Ansible's debug channel, so existing self.log(...) sites automatically populate the new log file when log_mode: file is set.
  • plugins/doc_fragments/azure.py replaces the stale "Parent argument." descriptions for log_mode and log_path with real behavior documentation and distinguishes them from Ansible-core's ANSIBLE_LOG_PATH.
REFERENCE

@zunyangc zunyangc added documentation Improvements or additions to documentation enhancement New feature or request working In trying to solve, or in working with contributors labels Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request working In trying to solve, or in working with contributors

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve error messages for microsoft support

1 participant

0