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

Cannot bind argument to parameter 'Name' because it is null #469

Closed
MezTemplar opened this issue Jul 4, 2024 · 3 comments
Closed

Cannot bind argument to parameter 'Name' because it is null #469

MezTemplar opened this issue Jul 4, 2024 · 3 comments
Assignees
Labels
Azure PowerShell For Azure PowerShell issues.

Comments

@MezTemplar
Copy link

I'm getting "Error: Login failed with Error: Azure PowerShell login failed with error: Cannot bind argument to parameter 'Name' because it is null." using the following YAML on a self-hosted runner.

  - name: Log in with Azure
    uses: azure/login@v2
    with:
      creds: '${{ secrets.AZURE_CREDENTIALS }}'
      enable-AzPSSession: true

Here is the full debug:

##[debug]Reading creds in JSON...
::add-mask::***
::add-mask::***
Running Azure CLI Login.
##[debug]Azure CLI path: /usr/bin/az
##[debug]Azure CLI version used:
##[debug]azure-cli 2.61.0
##[debug]
##[debug]core 2.61.0
##[debug]telemetry 1.1.0
##[debug]
##[debug]Dependencies:
##[debug]msal 1.28.0
##[debug]azure-mgmt-resource 23.1.1
##[debug]
##[debug]Python location '/opt/az/bin/python3'
##[debug]Extensions directory '/home/runner/.azure/cliextensions'
##[debug]
##[debug]Python (Linux) 3.11.8 (main, May 16 2024, 03:47:28) [GCC 11.4.0]
##[debug]
##[debug]Legal docs and information: aka.ms/AzureCliLegal
##[debug]
##[debug]
##[debug]Your CLI is up-to-date.
##[debug]
/usr/bin/az cloud set -n azurecloud
Done setting cloud: "azurecloud"
Note: Azure/login action also supports OIDC login mechanism. Refer https://github.com/azure/login#configure-a-service-principal-with-a-federated-credential-to-use-oidc-based-authentication for more details.
Attempting Azure CLI login by using service principal with secret...
Subscription is set successfully.
Azure CLI login succeeds by using service principal with secret.
Running Azure PowerShell Login.
##[debug]Set PSModulePath as /usr/share:undefined
##[debug]The script to import the latest Az.Accounts: try ***
##[debug] $ErrorActionPreference = "Stop"
##[debug] $WarningPreference = "SilentlyContinue"
##[debug] $output = @***
##[debug] $latestModulePath = (Get-Module -Name 'Az.Accounts' -ListAvailable | Sort-Object Version -Descending | Select-Object -First 1).Path
##[debug] Import-Module -Name $latestModulePath
##[debug] $output['Success'] = $true
##[debug] $output['Result'] = $latestModulePath
##[debug] ***
##[debug] catch ***
##[debug] $output['Success'] = $false
##[debug] $output['Error'] = $_.exception.Message
##[debug] ***
##[debug] return ConvertTo-Json $output


Error: "Cannot bind argument to parameter 'Name' because it is null.",
Success: false


Error: Login failed with Error: Azure PowerShell login failed with error: Cannot bind argument to parameter 'Name' because it is null.. Double check if the 'auth-type' is correct. Refer to https://github.com/Azure/login#readme for more information.
##[debug]Error: Azure PowerShell login failed with error: Cannot bind argument to parameter 'Name' because it is null.
##[debug] at AzPSUtils. (/home/runner/_work/_actions/azure/login/v2/lib/main/index.js:4451:23)
##[debug] at Generator.next ()
##[debug] at fulfilled (/home/runner/_work/_actions/azure/login/v2/lib/main/index.js:4366:58)
##[debug] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
##[debug]Node Action run completed with exit code 1
##[debug]Finishing: Log in with Azure

@MezTemplar MezTemplar added the need-to-triage Requires investigation label Jul 4, 2024
@MoChilia MoChilia added Azure PowerShell For Azure PowerShell issues. and removed need-to-triage Requires investigation labels Jul 9, 2024
@YanaXu
Copy link
Collaborator

YanaXu commented Jul 10, 2024

Hi @MezTemplar, do you use a self-hosted runner without Azure PowerShell installed? If yes, could you install Azure PowerShell module before using Azure Login Action?

@MezTemplar
Copy link
Author

Hi @MezTemplar, do you use a self-hosted runner without Azure PowerShell installed? If yes, could you install Azure PowerShell module before using Azure Login Action?

I added the Az module to pwsh in a step before the login and it worked so I guess that was the problem. Maybe a clearer message would be helpful?

@YanaXu
Copy link
Collaborator

YanaXu commented Jul 11, 2024

Thanks @MezTemplar. Yes, you're right and it's tracked in #463 . I'll close this issue and let's track the error message improvement in #463.

@YanaXu YanaXu closed this as completed Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure PowerShell For Azure PowerShell issues.
Projects
None yet
Development

No branches or pull requests

3 participants