Skip to content

Conversation

@RolandKrummenacher
Copy link
Collaborator

πŸ› οΈ Description

Initialize $toolkitPath before the try block to ensure cleanup works even if an early failure occurs. The $toolkitPath variable was being set inside the try block, but the finally block attempted to use it for cleanup. If an error occurred before $toolkitPath was set (e.g., when $env:temp is not defined on Linux/Cloud Shell), the cleanup failed with "Cannot bind argument to parameter 'Path' because it is null", masking the real error.

Fixes #665

πŸ“· Screenshots

N/A - Code fix only

πŸ“‹ Checklist

πŸ”¬ How did you test this change?

  • 🀏 Lint tests
  • 🀞 PS -WhatIf / az validate
  • πŸ‘ Manually deployed + verified
  • πŸ’ͺ Unit tests
  • πŸ™Œ Integration tests

πŸ™‹β€β™€οΈ Do any of the following that apply?

  • 🚨 This is a breaking change.
  • 🀏 The change is less than 20 lines of code.

πŸ“‘ Did you update docs/changelog.md?

  • βœ… Updated changelog (required for dev PRs)
  • ➑️ Will add log in a future PR (feature branch PRs only)
  • ❎ Log not needed (small/internal change)

πŸ“– Did you update documentation?

  • βœ… Public docs in docs (required for dev)
  • βœ… Public docs in docs-mslearn (required for dev)
  • βœ… Internal dev docs in docs-wiki (required for dev)
  • βœ… Internal dev docs in src (required for dev)
  • ➑️ Will add docs in a future PR (feature branch PRs only)
  • ❎ Docs not needed (small/internal change)

@microsoft-github-policy-service microsoft-github-policy-service bot added Micro PR πŸ”¬ Very small PR that should be especially easy for newcomers Needs: Review πŸ‘€ PR that is ready to be reviewed labels Feb 9, 2026
@RolandKrummenacher RolandKrummenacher force-pushed the fix/665-deploy-finopshub-temp-path branch 3 times, most recently from 9eaa4ee to 1d75a84 Compare February 9, 2026 15:34
Two issues were causing Deploy-FinOpsHub to fail in Cloud Shell/Linux:

1. Bicep CLI requires the TEMP environment variable, which is not set on Linux/Mac.
   Added code to set TEMP from [System.IO.Path]::GetTempPath() if not present.

2. If an error occurred before $toolkitPath was set, the finally block cleanup
   failed with 'Cannot bind argument to parameter Path because it is null',
   masking the real error. Initialized $toolkitPath before the try block and
   added a null check before cleanup.

Fixes #665
@RolandKrummenacher RolandKrummenacher added this to the v14 milestone Feb 9, 2026
@RolandKrummenacher RolandKrummenacher marked this pull request as ready for review February 9, 2026 15:56
@flanakin flanakin modified the milestones: v14, v13 Feb 10, 2026
@RolandKrummenacher RolandKrummenacher merged commit 2a7b983 into dev Feb 10, 2026
5 checks passed
@RolandKrummenacher RolandKrummenacher deleted the fix/665-deploy-finopshub-temp-path branch February 10, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Micro PR πŸ”¬ Very small PR that should be especially easy for newcomers Needs: Review πŸ‘€ PR that is ready to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deploy-FinOpsHub throws "Cannot bind argument to parameter 'Path' because it is null" when ran from Azure Devops agent

3 participants