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

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

Open
erose96 opened this issue Apr 2, 2024 · 0 comments
Assignees
Labels
Needs: Triage 🔍 Untriaged issue needs to be reviewed Type: Bug 🐛 Something isn't working

Comments

@erose96
Copy link

erose96 commented Apr 2, 2024

🐛 Problem

Deploy-FinOpsHub throws the error "Cannot bind argument to parameter 'Path' because it is null" when ran in an Azure Devops pipeline. I think this is caused by the $env:temp call the function makes which Azure Devops agents seem to have an issue with.

👣 Repro steps

  1. Create an AzurePowershell@5 Azure Devops task that installs and imports the FinOpsToolkit pwsh module
  2. Add a Deploy-FinOpsHub call to the script
  3. See the error

🤔 Expected

Should attempt to resolve a different path if $env:temp returns $null.

ℹ️ Additional context

Azure Devops task I am using:

        - task: AzurePowerShell@5
            displayName: 'Deploy TSC FinOps Hub'
            inputs:
              azureSubscription: $(Subscription)
              pwsh: true
              azurePowershellVersion: LatestVersion
              ScriptType: 'InlineScript'
              Inline: |
                Write-Output "Installing FinOps Toolkit pwsh module"
                Install-Module -Name FinOpsToolkit -Force -Confirm:$false
                Import-Module -Name FinOpsToolkit
                $version = "${{ parameters.Version }}"
                $name = "$(ResourcesNames)"
                $resourceGroup = "$(ResourceGroup)"
                Deploy-FinOpsHub `
                  -Name $name `
                  -ResourceGroup $resourceGroup `
                  -Location "eastus" `
                  -Preview:$true `
                  -Version $version
                Write-Output "Deployment complete"

My current workaround is to add the following at the beginning of the inline script:

                [Environment]::SetEnvironmentVariable("temp", "/home/vsts/work/_temp/")

🙋‍♀️ Ask for the community

Let me know if others can reproduce this, especially with GitHub Actions whose runners images are built from the same Dockerfiles as the Azure Devops agents.

We could use your help:

  1. Please vote this issue up (👍) to prioritize it.
  2. Leave comments to help us solidify the vision.
@erose96 erose96 added Needs: Triage 🔍 Untriaged issue needs to be reviewed Type: Bug 🐛 Something isn't working labels Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Triage 🔍 Untriaged issue needs to be reviewed Type: Bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants