Skip to content

Comments

fix: Error: "An invalid IP address was specified."#63

Open
eddiewhho wants to merge 1 commit intoAzure:masterfrom
eddiewhho:Fix_IP_Error
Open

fix: Error: "An invalid IP address was specified."#63
eddiewhho wants to merge 1 commit intoAzure:masterfrom
eddiewhho:Fix_IP_Error

Conversation

@eddiewhho
Copy link

@eddiewhho eddiewhho commented Sep 10, 2025

This pull request improves the robustness and accuracy of subnet mask extraction and calculation in both AzGovVizParallel.ps1 and processNetwork.ps1. The main focus is on correctly handling subnet prefixes, validating input, and providing better error handling to prevent runtime issues during IP address calculations.

Subnet mask extraction and validation improvements:

  • Updated the method for extracting the subnet mask from AddressPrefix to correctly handle both single and double digit prefixes using a split operation instead of substring, making the code more reliable. [1] [2]
  • Added validation for the extracted subnet prefix to ensure it is a valid integer between 0 and 32. If the prefix is invalid, the code now logs a warning and skips subnet mask calculation, preventing potential errors. [1] [2]

Error handling enhancements:

  • Wrapped the subnet mask calculation logic in a try-catch block. If an exception occurs (e.g., due to invalid input), a warning is logged and the subnet mask and range are set to "Error", improving the script's resilience. [1] [2]

@eddiewhho eddiewhho changed the title fixing: Error: "An invalid IP address was specified." fix: Error: "An invalid IP address was specified." Sep 10, 2025
@eddiewhho
Copy link
Author

@microsoft-github-policy-service agree

@jtracey93
Copy link
Collaborator

@JulianHayward for your review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants