Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Deploy-FinOpsHub.ps1 #1243

Merged
merged 1 commit into from
Jan 26, 2025
Merged

Update Deploy-FinOpsHub.ps1 #1243

merged 1 commit into from
Jan 26, 2025

Conversation

JayAreP
Copy link
Contributor

@JayAreP JayAreP commented Jan 14, 2025

when expressing a [switch] parameter as a boolean in a hashtable you need to express the .IsPresent property.

enableInfrastructureEncryption was being parsed as an object rather than a boolean causing the error:

Error: Code=InvalidTemplate; Message=Deployment template validation failed: 'The provided value for the template parameter 'enableInfrastructureEncryption' is not valid. Expected a value of type 'Boolean', but received a value of type 'Object'.

🛠️ Description

Fixes #

📷 Screenshots

📋 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)
  • ✅ 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)

when expressing a [switch] as a boolean in a hashtable you need to express the .IsPresent property.

enableInfrastructureEncryption was being parsed as an object rather than a boolean causing the error:

Error: Code=InvalidTemplate; Message=Deployment template validation failed: 'The provided value for the template parameter 'enableInfrastructureEncryption' is not valid. Expected a value of type 'Boolean', but received a value of type 'Object'.
@JayAreP
Copy link
Contributor Author

JayAreP commented Jan 14, 2025

Was getting errors when attempting to Deploy-FinOpsHub. Was in Azure CloudShell PS session, but the switch behavior is consistent.

Example:

function switchtest {
    param(
        [switch] $switchtest
    )

    $hashtable = @{}
    $hashtable.Add("SwitchTest",$switchtest)

    return $hashtable
}

If you then run switchtest -switchtest | convertto-json
You'll see the resulting object rather than the expected boolean:

{
  "SwitchTest": {
    "IsPresent": true
  }
}

@flanakin flanakin added this to the 2025-01 - January milestone Jan 26, 2025
@flanakin
Copy link
Collaborator

@allcontributors Please add JayAreP for code

Copy link
Contributor

@flanakin

I've put up a pull request to add @JayAreP! 🎉

@flanakin flanakin merged commit 1353127 into microsoft:dev Jan 26, 2025
2 checks passed
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 Tool: FinOps hubs Data pipeline solution Tool: PowerShell PowerShell scripts and automation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants