feat: Add NetworkConnectivity pre-flight check to Test-AcceleratorRequirement#527
Merged
jaredfholgate merged 3 commits intomainfrom Mar 25, 2026
Merged
Conversation
Co-authored-by: jtracey93 <41163455+jtracey93@users.noreply.github.com> Agent-Logs-Url: https://github.com/Azure/ALZ-PowerShell-Module/sessions/0b9f35e0-c938-411a-841a-734c6907f833
Copilot
AI
changed the title
[WIP] Add NetworkConnectivity check for Bicep deployment
Add NetworkConnectivity pre-flight check to Test-AcceleratorRequirement
Mar 25, 2026
…tivity into Deploy-Accelerator Co-authored-by: jtracey93 <41163455+jtracey93@users.noreply.github.com> Agent-Logs-Url: https://github.com/Azure/ALZ-PowerShell-Module/sessions/f1695757-ab9f-4be9-a440-009ed85a14bd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Deploy-Accelerator.ps1andTest-NetworkConnectivity.ps1https://www.powershellgallery.comendpoint toTest-NetworkConnectivity.ps1NetworkConnectivityto the checks inDeploy-Accelerator.ps1(guarded byskip_internet_checks)Test-NetworkConnectivity.Tests.ps1endpoint count assertions: 5 → 6Original prompt
Summary
Add a new
NetworkConnectivitycheck toTest-AcceleratorRequirement(and the underlyingTest-Toolingplumbing) that probes the external URLs the module must reach during a Bicep deployment, before any download or API call is attempted.Background
Currently the module has no pre-flight network reachability check. It assumes connectivity is present and only surfaces failures at the point of use (e.g. inside
Invoke-WebRequest/Invoke-RestMethod). This makes it hard for users in restricted environments to diagnose connectivity issues early.Changes Required
1. New file:
src/ALZ/Private/Tools/Checks/Test-NetworkConnectivity.ps1Create a new check function following the same pattern as the existing checks (e.g.
Test-GitInstallation.ps1). It should:Invoke-WebRequestwith-Method Head(or a lightweight GET where HEAD is not supported), with a short timeout (e.g. 10 seconds) and-SkipHttpErrorCheck/-ErrorAction SilentlyContinueso it doesn't throw.Resultsarray and aHasFailurebool in the same shape as all other checks.https://api.github.comhttps://gh.wkk.suhttps://api.releases.hashicorp.comhttps://releases.hashicorp.comhttps://management.azure.comExample skeleton (follow the pattern of
Test-GitInstallation.ps1):2. Update
src/ALZ/Private/Tools/Test-Tooling.ps1"NetworkConnectivity"to the[ValidateSet(...)]on the$Checksparameter.if ($Checks -contains "NetworkConnectivity")block that callsTest-NetworkConnectivityand accumulates results, following the same pattern as the other checks.3. Update
src/ALZ/Public/Test-AcceleratorRequirement.ps1"NetworkConnectivity"to the[ValidateSet(...)]on the$Checksparameter."NetworkConnectivity"to the default value of$Checksso it runs automatically whenTest-AcceleratorRequirementis called with no arguments..SYNOPSIS/.DESCRIPTIONdoc comment to mention the network connectivity check.4. Add unit tests:
src/Tests/Unit/Private/Test-NetworkConnectivity.Tests.ps1Add Pester unit tests for
Test-NetworkConnectivityfollowing the pattern used by other tests insrc/Tests/Unit/. Cover at minimum:Invoke-WebRequestto throw) →HasFailure = $true, correct Failure messages.Notes
NetworkConnectivityto the default checks insideDeploy-Accelerator.ps1— it already has its own$skip_internet_checksbypass path and calling a network check there would be redundant. The check belongs inTest-AcceleratorRequirementonly.This pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.