azsk/ADOScanner

Getting error on executing Get-AzSKADOSecurityStatus command

Closed this issue · 2 comments

Getting error on executing Get-AzSKADOSecurityStatus command

I have installed and imported AzSK.ADO module. I am part of the Project Administrator group on the ADO project for which I want to get the security scan result. However when I run the command:
image

I am getting the error: "Organization not found: Incorrect organization name or you do not have necessary permission to access the organization"

Can someone please guide me what I am doing wrong here, and how I can get the expected outcome?

Steps to reproduce

Import-Module AzSK.ADO
Get-AzSKADOSecurityStatus -OrganizationName "OrgName" -ProjectNames "ProjectName"

Expected behavior

Scan Result

Actual behavior

Getting error. Error Message:
Organization not found: Incorrect organization name or you do not have necessary permission to access the organization.
InvalidOperation: Invalid JSON primitive: .

This could be due to the logged in identity does not have access to the organization.
To ensure that the ADOScanner use the correct identity, you can force the sign-in dialog to appear by setting a variable.

Try the below commands in fresh PowerShell session, also ensure all other sessions are closed.

$AzSKADOLoginUI = 1       ## Helps you ensure log in with the correct identity
Import-Module AzSK.ADO
Get-AzSKADOSecurityStatus -OrganizationName $orgname