Skip to content

fix: Deploy-FinOpsHub fails in Cloud Shell/Linux (#665)#1975

Merged
RolandKrummenacher merged 1 commit into
devfrom
fix/665-deploy-finopshub-temp-path
Feb 10, 2026
Merged

fix: Deploy-FinOpsHub fails in Cloud Shell/Linux (#665)#1975
RolandKrummenacher merged 1 commit into
devfrom
fix/665-deploy-finopshub-temp-path

Conversation

@RolandKrummenacher

Copy link
Copy Markdown
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