microsoft / azure-pipelines-tasks

Tasks for Azure Pipelines
https://aka.ms/tfbuild
MIT License
3.45k stars 2.6k forks source link

AzureCLI task is failing with error "The term 'Get-AzADGroup' is not recognized as a name of a cmdlet, function, script file, or executable program" #19861

Open jakerosedatacom opened 3 months ago

jakerosedatacom commented 3 months ago

New issue checklist

Task name

AzureCLI

Breaking task version

2.237.3

Last working task version

2.230.0

Regression Description

As of 2.237.3 I am getting lots of different errors all centering around the Az context being invalid and a message to "Please login using Connect-AzAccount.

At 2.230.0 I didn't have any issues and the code hasn't changed.

In order to test the Service Principal still has the correct permissions I have converted certain scripts to instead use the AzurePowershell@5 task and they are all completing successfully.

Environment type (Please select at least one enviroment where you face this issue)

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

ubuntu-latest

Relevant log output

See two separate errors below

Az.MSGraph.internal\Get-AzAdGroup : The context is invalid. Please login using Connect-AzAccount.
At /home/vsts/.local/share/powershell/Modules/Az.Resources/6.16.2/MSGraph.Autorest/custom/Get-AzADGroup.ps1:179 char:9
+         Az.MSGraph.internal\Get-AzAdGroup @PSBoundParameters
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Get-AzADGroup_List], InvalidOperationException
+ FullyQualifiedErrorId : Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Cmdlets.GetAzADGroup_List

And

Set-AzContext : Run Connect-AzAccount to login.
At /home/vsts/work/1/s/DeploymentArtifacts/resources/02 - Data factory and shared IR.ps1:29 char:1
+ Set-AzContext -Subscription $subscription_id
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : CloseError: (:) [Set-AzContext], PSInvalidOperationException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Profile.SetAzureRMContextCommand

Full task logs with system.debug enabled

UNSUCCESSFUL RUN
 [REPLACE THIS WITH YOUR INFORMATION] 
SUCCESSFUL RUN
 [REPLACE THIS WITH YOUR INFORMATION] 

Repro steps

Script.ps1

 parameters
[CmdletBinding()]
param(
  $subscription_id,
  $rg_groupname,
  $rg_location,
  $aad_group
)
  Write-Host $subscription_id
  Write-Host $rg_groupname
  Write-Host $rg_location
  Write-Host $aad_group

az account set --subscription $subscription_id
az account show

Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
Install-Module -Name Az.Resources -Force -AllowClobber
Install-Module Az -AllowClobber

# check if resource group exists
$rgExists = (az group exists --name $rg_groupname)

# create if not exists
if ($rgExists -eq 'false') {
    az group create --name $rg_groupname --location $rg_location

    Start-Sleep -s 30
}

# set databricks resource group scope
$workspaceScope="/subscriptions/$subscription_id/resourceGroups/$rg_groupname"

# grant rg contributor permissions to aad group
$group = Get-AzADGroup -DisplayName $aad_group
$groupId = $group.Id

$roleDefinitionName = "Contributor"
# Check if the role assignment already exists
$existingAssignment = Get-AzRoleAssignment -ObjectId $groupId -Scope $workspaceScope -RoleDefinitionName $roleDefinitionName

if ($existingAssignment) {
    Write-Host "The role assignment already exists."
}
else {
    # Create the role assignment
    New-AzRoleAssignment -ObjectId $groupId -RoleDefinitionName $roleDefinitionName -Scope $workspaceScope
    Write-Host "The role assignment has been created."
}

  - task: AzureCLI@2
    displayName: "Provision Resource Group"
    inputs:
      azureSubscription: "sp-all-cawthron"
      scriptType: "pscore"
      scriptLocation: "scriptPath"
      scriptPath: "$(github_folder)/resources/Script.ps1"
      arguments: "-subscription_id $(subscription_id) -rg_groupname $(rg_groupname) -rg_location $(rg_location) -aad_group $(aad_group)"
v-schhabra commented 3 months ago

@jakerosedatacom Could you please share the detailed logs of the pipeline by adding the variable system.debug to "true".

jakerosedatacom commented 3 months ago

@v-schhabra , here you go

2024-05-19T21:09:27.8195721Z ##[debug]Evaluating condition for step: 'Provision Resource Group' 2024-05-19T21:09:27.8197706Z ##[debug]Evaluating: SucceededNode() 2024-05-19T21:09:27.8198357Z ##[debug]Evaluating SucceededNode: 2024-05-19T21:09:27.8199664Z ##[debug]=> True 2024-05-19T21:09:27.8200347Z ##[debug]Result: True 2024-05-19T21:09:27.8200914Z ##[section]Starting: Provision Resource Group 2024-05-19T21:09:27.8207927Z ============================================================================== 2024-05-19T21:09:27.8208343Z Task : Azure CLI 2024-05-19T21:09:27.8208550Z Description : Run Azure CLI commands against an Azure subscription in a PowerShell Core/Shell script when running on Linux agent or PowerShell/PowerShell Core/Batch script when running on Windows agent. 2024-05-19T21:09:27.8208904Z Version : 2.239.3 2024-05-19T21:09:27.8209078Z Author : Microsoft Corporation 2024-05-19T21:09:27.8209295Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-cli 2024-05-19T21:09:27.8209609Z ============================================================================== 2024-05-19T21:09:27.9272900Z ##[debug]Using node path: /home/vsts/agents/3.239.1/externals/node20_1/bin/node 2024-05-19T21:09:28.0267981Z ##[debug]agent.TempDirectory=/home/vsts/work/_temp 2024-05-19T21:09:28.0292853Z ##[debug]loading inputs and endpoints 2024-05-19T21:09:28.0303476Z ##[debug]loading INPUT_CONNECTEDSERVICENAMEARM 2024-05-19T21:09:28.0328832Z ##[debug]loading INPUT_SCRIPTTYPE 2024-05-19T21:09:28.0335348Z ##[debug]loading INPUT_SCRIPTLOCATION 2024-05-19T21:09:28.0341016Z ##[debug]loading INPUT_SCRIPTPATH 2024-05-19T21:09:28.0347406Z ##[debug]loading INPUT_SCRIPTARGUMENTS 2024-05-19T21:09:28.0353152Z ##[debug]loading INPUT_POWERSHELLERRORACTIONPREFERENCE 2024-05-19T21:09:28.0359288Z ##[debug]loading INPUT_ADDSPNTOENVIRONMENT 2024-05-19T21:09:28.0367382Z ##[debug]loading INPUT_USEGLOBALCONFIG 2024-05-19T21:09:28.0375994Z ##[debug]loading INPUT_CWD 2024-05-19T21:09:28.0384993Z ##[debug]loading INPUT_FAILONSTANDARDERROR 2024-05-19T21:09:28.0392352Z ##[debug]loading INPUT_POWERSHELLIGNORELASTEXITCODE 2024-05-19T21:09:28.0400086Z ##[debug]loading ENDPOINT_AUTH_0d5f8d84-cdde-43d9-8a10-4559466e99a9 2024-05-19T21:09:28.0406981Z ##[debug]loading ENDPOINT_AUTH_SCHEME_0d5f8d84-cdde-43d9-8a10-4559466e99a9 2024-05-19T21:09:28.0435535Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_0d5f8d84-cdde-43d9-8a10-4559466e99a9_SERVICEPRINCIPALID 2024-05-19T21:09:28.0442298Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_0d5f8d84-cdde-43d9-8a10-4559466e99a9_AUTHENTICATIONTYPE 2024-05-19T21:09:28.0448175Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_0d5f8d84-cdde-43d9-8a10-4559466e99a9_TENANTID 2024-05-19T21:09:28.0466121Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_0d5f8d84-cdde-43d9-8a10-4559466e99a9_SERVICEPRINCIPALKEY 2024-05-19T21:09:28.0473945Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION 2024-05-19T21:09:28.0479718Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION 2024-05-19T21:09:28.0485764Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN 2024-05-19T21:09:28.0532786Z ##[debug]loading SECRET_SYSTEM_ACCESSTOKEN 2024-05-19T21:09:28.0538729Z ##[debug]loading SECRET_ADF_SHARED_IR_KEY 2024-05-19T21:09:28.0543992Z ##[debug]loading SECRET_CLIENT_SECRET 2024-05-19T21:09:28.0548569Z ##[debug]loading SECRET_DLS_KEY 2024-05-19T21:09:28.0553199Z ##[debug]loading SECRET_ADF_SHARED_IR_USER 2024-05-19T21:09:28.0557758Z ##[debug]loading SECRET_DLS_ENDPOINT 2024-05-19T21:09:28.0562317Z ##[debug]loaded 26 2024-05-19T21:09:28.0587363Z ##[debug]Agent.ProxyUrl=undefined 2024-05-19T21:09:28.0592533Z ##[debug]Agent.CAInfo=undefined 2024-05-19T21:09:28.0596486Z ##[debug]Agent.ClientCert=undefined 2024-05-19T21:09:28.0600106Z ##[debug]Agent.SkipCertValidation=undefined 2024-05-19T21:09:28.2401910Z ##[debug]check path : /home/vsts/work/_tasks/AzureCLI_46e4be58-730b-4389-8a2f-ea10b3e5e815/2.239.3/task.json 2024-05-19T21:09:28.2405144Z ##[debug]adding resource file: /home/vsts/work/_tasks/AzureCLI_46e4be58-730b-4389-8a2f-ea10b3e5e815/2.239.3/task.json 2024-05-19T21:09:28.2407135Z ##[debug]system.culture=en-US 2024-05-19T21:09:28.2422575Z ##[debug]which 'az' 2024-05-19T21:09:28.2429115Z ##[debug]found: '/usr/bin/az' 2024-05-19T21:09:28.2440513Z ##[debug]scriptType=pscore 2024-05-19T21:09:28.2446429Z ##[debug]scriptLocation=scriptPath 2024-05-19T21:09:28.2447305Z ##[debug]scriptArguments=-subscription_id -rg_groupname -rg_location australiaeast -aad_group 2024-05-19T21:09:28.2450731Z ##[debug]powerShellErrorActionPreference=stop 2024-05-19T21:09:28.2454766Z ##[debug]Agent.Version=3.239.1 2024-05-19T21:09:28.2457946Z ##[debug]Agent.TempDirectory=/home/vsts/work/_temp 2024-05-19T21:09:28.2458767Z ##[debug]scriptPath=/home/vsts/work/1/s/DeploymentArtifacts/resources/01 - Resource group.ps1 2024-05-19T21:09:28.2459754Z ##[debug]powerShellIgnoreLASTEXITCODE=false 2024-05-19T21:09:28.2463991Z ##[debug]which 'pwsh' 2024-05-19T21:09:28.2468704Z ##[debug]found: '/usr/bin/pwsh' 2024-05-19T21:09:28.2469949Z ##[debug]which '/usr/bin/pwsh' 2024-05-19T21:09:28.2471453Z ##[debug]found: '/usr/bin/pwsh' 2024-05-19T21:09:28.2473512Z ##[debug]/usr/bin/pwsh arg: -NoLogo 2024-05-19T21:09:28.2474503Z ##[debug]/usr/bin/pwsh arg: -NoProfile 2024-05-19T21:09:28.2475886Z ##[debug]/usr/bin/pwsh arg: -NonInteractive 2024-05-19T21:09:28.2476663Z ##[debug]/usr/bin/pwsh arg: -ExecutionPolicy 2024-05-19T21:09:28.2477237Z ##[debug]/usr/bin/pwsh arg: Unrestricted 2024-05-19T21:09:28.2477818Z ##[debug]/usr/bin/pwsh arg: -Command 2024-05-19T21:09:28.2478478Z ##[debug]/usr/bin/pwsh arg: . '/home/vsts/work/_temp/azureclitaskscript1716152968245.ps1' 2024-05-19T21:09:28.2483327Z ##[debug]cwd=/home/vsts/work/1/s 2024-05-19T21:09:28.2486429Z ##[debug]scriptLocation=scriptPath 2024-05-19T21:09:28.2489303Z ##[debug]failOnStandardError=false 2024-05-19T21:09:28.2492417Z ##[debug]testing directory '/home/vsts/work/1/s' 2024-05-19T21:09:28.2524133Z ##[debug]which 'az' 2024-05-19T21:09:28.2528992Z ##[debug]found: '/usr/bin/az' 2024-05-19T21:09:28.2531983Z ##[debug]/usr/bin/az arg: --version 2024-05-19T21:09:28.2533408Z ##[debug]/usr/bin/az arg: --version 2024-05-19T21:09:28.2548077Z ##[debug]exec tool: /usr/bin/az 2024-05-19T21:09:28.2556082Z ##[debug]exec tool: /usr/bin/az 2024-05-19T21:09:28.2558125Z ##[debug]arguments: 2024-05-19T21:09:28.2558784Z ##[debug]arguments: 2024-05-19T21:09:28.2559261Z ##[debug] --version 2024-05-19T21:09:28.2560023Z ##[debug] --version 2024-05-19T21:09:28.2560565Z [command]/usr/bin/az --version 2024-05-19T21:09:29.1616668Z azure-cli 2.60.0 2024-05-19T21:09:29.1618413Z 2024-05-19T21:09:29.1619243Z core 2.60.0 2024-05-19T21:09:29.1619781Z telemetry 1.1.0 2024-05-19T21:09:29.1619932Z 2024-05-19T21:09:29.1620206Z Extensions: 2024-05-19T21:09:29.1620646Z azure-devops 1.0.1 2024-05-19T21:09:29.1620851Z 2024-05-19T21:09:29.1621103Z Dependencies: 2024-05-19T21:09:29.1621545Z msal 1.28.0 2024-05-19T21:09:29.1622111Z azure-mgmt-resource 23.1.0b2 2024-05-19T21:09:29.1622291Z 2024-05-19T21:09:29.1622662Z Python location '/opt/az/bin/python3' 2024-05-19T21:09:29.1623104Z Extensions directory '/opt/az/azcliextensions' 2024-05-19T21:09:29.1623288Z 2024-05-19T21:09:29.1623743Z Python (Linux) 3.11.8 (main, Apr 24 2024, 04:14:09) [GCC 11.4.0] 2024-05-19T21:09:29.1623920Z 2024-05-19T21:09:29.1624331Z Legal docs and information: aka.ms/AzureCliLegal 2024-05-19T21:09:29.1624475Z 2024-05-19T21:09:29.1624739Z 2024-05-19T21:09:29.1625365Z Your CLI is up-to-date. 2024-05-19T21:09:29.1626020Z ##[debug]useGlobalConfig=false 2024-05-19T21:09:29.1626727Z ##[debug]Agent.TempDirectory=/home/vsts/work/_temp 2024-05-19T21:09:29.1627252Z ##[debug]Agent.TempDirectory=/home/vsts/work/_temp 2024-05-19T21:09:29.1638447Z Setting AZURE_CONFIG_DIR env variable to: /home/vsts/work/_temp/.azclitask 2024-05-19T21:09:29.1649679Z ##[debug]connectedServiceNameARM=0d5f8d84-cdde-43d9-8a10-4559466e99a9 2024-05-19T21:09:29.1655447Z ##[debug]0d5f8d84-cdde-43d9-8a10-4559466e99a9 data environment = AzureCloud 2024-05-19T21:09:29.1659911Z Setting active cloud to: AzureCloud 2024-05-19T21:09:29.1664297Z ##[debug]which 'az' 2024-05-19T21:09:29.1674521Z ##[debug]found: '/usr/bin/az' 2024-05-19T21:09:29.1678736Z ##[debug]/usr/bin/az arg: cloud set -n AzureCloud 2024-05-19T21:09:29.1682416Z ##[debug]/usr/bin/az arg: cloud set -n AzureCloud 2024-05-19T21:09:29.1686485Z ##[debug]exec tool: /usr/bin/az 2024-05-19T21:09:29.1690252Z ##[debug]exec tool: /usr/bin/az 2024-05-19T21:09:29.1694447Z ##[debug]arguments: 2024-05-19T21:09:29.1698819Z ##[debug]arguments: 2024-05-19T21:09:29.1703567Z ##[debug] cloud 2024-05-19T21:09:29.1708003Z ##[debug] cloud 2024-05-19T21:09:29.1712851Z ##[debug] set 2024-05-19T21:09:29.1717625Z ##[debug] set 2024-05-19T21:09:29.1721614Z ##[debug] -n 2024-05-19T21:09:29.1725467Z ##[debug] -n 2024-05-19T21:09:29.1729282Z ##[debug] AzureCloud 2024-05-19T21:09:29.1733057Z ##[debug] AzureCloud 2024-05-19T21:09:29.1738319Z [command]/usr/bin/az cloud set -n AzureCloud 2024-05-19T21:09:29.6104745Z ##[debug]connectedServiceNameARM=0d5f8d84-cdde-43d9-8a10-4559466e99a9 2024-05-19T21:09:29.6106041Z ##[debug]0d5f8d84-cdde-43d9-8a10-4559466e99a9 auth scheme = ServicePrincipal 2024-05-19T21:09:29.6106796Z ##[debug]0d5f8d84-cdde-43d9-8a10-4559466e99a9 data SubscriptionID = 2024-05-19T21:09:29.6107515Z ##[debug]0d5f8d84-cdde-43d9-8a10-4559466e99a9 auth param authenticationType = spnKey 2024-05-19T21:09:29.6108335Z ##[debug]0d5f8d84-cdde-43d9-8a10-4559466e99a9 auth param serviceprincipalid = 2024-05-19T21:09:29.6109056Z ##[debug]0d5f8d84-cdde-43d9-8a10-4559466e99a9 auth param tenantid = 2024-05-19T21:09:29.6109818Z ##[debug]key based endpoint 2024-05-19T21:09:29.6110791Z ##[debug]0d5f8d84-cdde-43d9-8a10-4559466e99a9 auth param serviceprincipalkey = 2024-05-19T21:09:29.6112363Z ##[debug]Processed: ##vso[task.setsecret] 2024-05-19T21:09:29.6113197Z ##[debug]which 'az' 2024-05-19T21:09:29.6114676Z ##[debug]found: '/usr/bin/az' 2024-05-19T21:09:29.6115669Z ##[debug]/usr/bin/az arg: login --service-principal -u "" --password= --tenant "" --allow-no-subscriptions 2024-05-19T21:09:29.6117019Z ##[debug]/usr/bin/az arg: login --service-principal -u "" --password= --tenant "" --allow-no-subscriptions 2024-05-19T21:09:29.6117696Z ##[debug]exec tool: /usr/bin/az 2024-05-19T21:09:29.6118256Z ##[debug]exec tool: /usr/bin/az 2024-05-19T21:09:29.6118805Z ##[debug]arguments: 2024-05-19T21:09:29.6119354Z ##[debug]arguments: 2024-05-19T21:09:29.6119878Z ##[debug] login 2024-05-19T21:09:29.6120404Z ##[debug] login 2024-05-19T21:09:29.6120941Z ##[debug] --service-principal 2024-05-19T21:09:29.6121628Z ##[debug] --service-principal 2024-05-19T21:09:29.6122146Z ##[debug] -u 2024-05-19T21:09:29.6122648Z ##[debug] -u 2024-05-19T21:09:29.6123207Z ##[debug] 2024-05-19T21:09:29.6123781Z ##[debug] 2024-05-19T21:09:29.6124375Z ##[debug] --password= 2024-05-19T21:09:29.6124977Z ##[debug] --password= 2024-05-19T21:09:29.6125515Z ##[debug] --tenant 2024-05-19T21:09:29.6126120Z ##[debug] --tenant 2024-05-19T21:09:29.6126738Z ##[debug] 2024-05-19T21:09:29.6127551Z ##[debug] 2024-05-19T21:09:29.6128444Z ##[debug] --allow-no-subscriptions 2024-05-19T21:09:29.6129006Z ##[debug] --allow-no-subscriptions 2024-05-19T21:09:29.6130115Z [command]/usr/bin/az login --service-principal -u --password= --tenant --allow-no-subscriptions 2024-05-19T21:09:31.5312472Z [ 2024-05-19T21:09:31.5321830Z { 2024-05-19T21:09:31.5322539Z "cloudName": "AzureCloud", 2024-05-19T21:09:31.5323444Z "homeTenantId": "", 2024-05-19T21:09:31.5324178Z "id": "", 2024-05-19T21:09:31.5325630Z "isDefault": true, 2024-05-19T21:09:31.5326336Z "managedByTenants": [], 2024-05-19T21:09:31.5326884Z "name": "", 2024-05-19T21:09:31.5327388Z "state": "Enabled", 2024-05-19T21:09:31.5328059Z "tenantId": "", 2024-05-19T21:09:31.5328638Z "user": { 2024-05-19T21:09:31.5329353Z "name": "", 2024-05-19T21:09:31.5330055Z "type": "servicePrincipal" 2024-05-19T21:09:31.5330597Z } 2024-05-19T21:09:31.5331072Z } 2024-05-19T21:09:31.5331512Z ] 2024-05-19T21:09:31.5332503Z ##[debug]which 'az' 2024-05-19T21:09:31.5333322Z ##[debug]found: '/usr/bin/az' 2024-05-19T21:09:31.5334717Z ##[debug]/usr/bin/az arg: account set --subscription "" 2024-05-19T21:09:31.5335678Z ##[debug]/usr/bin/az arg: account set --subscription "" 2024-05-19T21:09:31.5336688Z ##[debug]exec tool: /usr/bin/az 2024-05-19T21:09:31.5337548Z ##[debug]exec tool: /usr/bin/az 2024-05-19T21:09:31.5339145Z ##[debug]arguments: 2024-05-19T21:09:31.5339823Z ##[debug]arguments: 2024-05-19T21:09:31.5340440Z ##[debug] account 2024-05-19T21:09:31.5341043Z ##[debug] account 2024-05-19T21:09:31.5341676Z ##[debug] set 2024-05-19T21:09:31.5342275Z ##[debug] set 2024-05-19T21:09:31.5342881Z ##[debug] --subscription 2024-05-19T21:09:31.5343676Z ##[debug] --subscription 2024-05-19T21:09:31.5344345Z ##[debug] e6bc3710-ce48-49c6-b170-f26f62906e25 2024-05-19T21:09:31.5345043Z ##[debug] e6bc3710-ce48-49c6-b170-f26f62906e25 2024-05-19T21:09:31.5345778Z [command]/usr/bin/az account set --subscription 2024-05-19T21:09:31.5346649Z ##[debug]addSpnToEnvironment=false 2024-05-19T21:09:31.5347351Z ##[debug]0d5f8d84-cdde-43d9-8a10-4559466e99a9 auth scheme = ServicePrincipal 2024-05-19T21:09:31.5348035Z ##[debug]exec tool: /usr/bin/pwsh 2024-05-19T21:09:31.5348676Z ##[debug]arguments: 2024-05-19T21:09:31.5349453Z ##[debug] -NoLogo 2024-05-19T21:09:31.5350084Z ##[debug] -NoProfile 2024-05-19T21:09:31.5350726Z ##[debug] -NonInteractive 2024-05-19T21:09:31.5351370Z ##[debug] -ExecutionPolicy 2024-05-19T21:09:31.5352002Z ##[debug] Unrestricted 2024-05-19T21:09:31.5352942Z ##[debug] -Command 2024-05-19T21:09:31.5353634Z ##[debug] . '/home/vsts/work/_temp/azureclitaskscript1716152968245.ps1' 2024-05-19T21:09:31.5354509Z [command]/usr/bin/pwsh -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command . '/home/vsts/work/_temp/azureclitaskscript1716152968245.ps1' 2024-05-19T21:09:32.4087140Z 2024-05-19T21:09:32.4089405Z 2024-05-19T21:09:32.4090197Z australiaeast 2024-05-19T21:09:32.4090854Z 2024-05-19T21:09:32.5904455Z ##[debug]Agent environment resources - Disk: / Available 21414.00 MB out of 74244.00 MB, Memory: Used 901.00 MB out of 6921.00 MB, CPU: Usage 17.35% 2024-05-19T21:09:33.6840827Z { 2024-05-19T21:09:33.6841834Z "environmentName": "AzureCloud", 2024-05-19T21:09:33.6842877Z "homeTenantId": "", 2024-05-19T21:09:33.6843576Z "id": "", 2024-05-19T21:09:33.6844381Z "isDefault": true, 2024-05-19T21:09:33.6845670Z "managedByTenants": [], 2024-05-19T21:09:33.6846142Z "name": "Cawthron Science", 2024-05-19T21:09:33.6846561Z "state": "Enabled", 2024-05-19T21:09:33.6847113Z "tenantId": "", 2024-05-19T21:09:33.6847698Z "user": { 2024-05-19T21:09:33.6850015Z "name": "", 2024-05-19T21:09:33.6850670Z "type": "servicePrincipal" 2024-05-19T21:09:33.6851149Z } 2024-05-19T21:09:33.6851653Z } 2024-05-19T21:09:37.5930465Z ##[debug]Agent environment resources - Disk: / Available 21414.00 MB out of 74244.00 MB, Memory: Used 907.00 MB out of 6921.00 MB, CPU: Usage 16.00% 2024-05-19T21:09:42.5936201Z ##[debug]Agent environment resources - Disk: / Available 21414.00 MB out of 74244.00 MB, Memory: Used 949.00 MB out of 6921.00 MB, CPU: Usage 14.83% 2024-05-19T21:09:42.7504284Z WARNING: User declined to install module (Az). 2024-05-19T21:09:45.4779265Z { 2024-05-19T21:09:45.4780539Z "id": "/subscriptions//resourceGroups/", 2024-05-19T21:09:45.4780999Z "location": "australiaeast", 2024-05-19T21:09:45.4781306Z "managedBy": null, 2024-05-19T21:09:45.4781675Z "name": "***", 2024-05-19T21:09:45.4781971Z "properties": { 2024-05-19T21:09:45.4782260Z "provisioningState": "Succeeded" 2024-05-19T21:09:45.4782547Z }, 2024-05-19T21:09:45.4782803Z "tags": null, 2024-05-19T21:09:45.4783108Z "type": "Microsoft.Resources/resourceGroups" 2024-05-19T21:09:45.4783456Z } 2024-05-19T21:09:47.5966996Z ##[debug]Agent environment resources - Disk: / Available 21413.00 MB out of 74244.00 MB, Memory: Used 973.00 MB out of 6921.00 MB, CPU: Usage 13.87% 2024-05-19T21:09:52.5967639Z ##[debug]Agent environment resources - Disk: / Available 21413.00 MB out of 74244.00 MB, Memory: Used 978.00 MB out of 6921.00 MB, CPU: Usage 13.02% 2024-05-19T21:09:57.5998767Z ##[debug]Agent environment resources - Disk: / Available 21413.00 MB out of 74244.00 MB, Memory: Used 978.00 MB out of 6921.00 MB, CPU: Usage 12.27% 2024-05-19T21:10:02.6016410Z ##[debug]Agent environment resources - Disk: / Available 21413.00 MB out of 74244.00 MB, Memory: Used 982.00 MB out of 6921.00 MB, CPU: Usage 11.57% 2024-05-19T21:10:07.6054293Z ##[debug]Agent environment resources - Disk: / Available 21413.00 MB out of 74244.00 MB, Memory: Used 982.00 MB out of 6921.00 MB, CPU: Usage 10.99% 2024-05-19T21:10:12.6110465Z ##[debug]Agent environment resources - Disk: / Available 21413.00 MB out of 74244.00 MB, Memory: Used 982.00 MB out of 6921.00 MB, CPU: Usage 10.44% 2024-05-19T21:10:15.8098226Z /home/vsts/work/1/s/DeploymentArtifacts/resources/01 - Resource group.ps1 : The term 'Get-AzADGroup' is not recognized as a name of a cmdlet, function, script file, or executable program. 2024-05-19T21:10:15.8100439Z Check the spelling of the name, or if a path was included, verify that the path is correct and try again. 2024-05-19T21:10:15.8101539Z At /home/vsts/work/_temp/azureclitaskscript1716152968245.ps1:3 char:1 2024-05-19T21:10:15.8103775Z + . '/home/vsts/work/1/s/DeploymentArtifacts/resources/01 - Resource gr … 2024-05-19T21:10:15.8104596Z + ~~~~~~~~~~~~~~~~~ 2024-05-19T21:10:15.8105307Z + CategoryInfo : ObjectNotFound: (Get-AzADGroup:String) [01 - Resource group.ps1], CommandNotFoundException 2024-05-19T21:10:15.8106292Z + FullyQualifiedErrorId : CommandNotFoundException,01 - Resource group.ps1 2024-05-19T21:10:15.9177953Z 2024-05-19T21:10:15.9222538Z ##[debug]Exit code 1 received from tool '/usr/bin/pwsh' 2024-05-19T21:10:15.9230789Z ##[debug]STDIO streams have closed for tool '/usr/bin/pwsh' 2024-05-19T21:10:15.9248127Z ##[debug]task result: Failed 2024-05-19T21:10:15.9297337Z ##[error]Script failed with exit code: 1 2024-05-19T21:10:15.9306200Z ##[debug]Processed: ##vso[task.issue type=error;source=TaskInternal;]Script failed with exit code: 1 2024-05-19T21:10:15.9308209Z ##[debug]Processed: ##vso[task.complete result=Failed;]Script failed with exit code: 1 2024-05-19T21:10:15.9309118Z ##[debug]which 'az' 2024-05-19T21:10:15.9310172Z ##[debug]found: '/usr/bin/az' 2024-05-19T21:10:15.9311247Z ##[debug]/usr/bin/az arg: account clear 2024-05-19T21:10:15.9312181Z ##[debug]/usr/bin/az arg: account clear 2024-05-19T21:10:15.9313095Z ##[debug]exec tool: /usr/bin/az 2024-05-19T21:10:15.9313986Z ##[debug]exec tool: /usr/bin/az 2024-05-19T21:10:15.9314893Z ##[debug]arguments: 2024-05-19T21:10:15.9315765Z ##[debug]arguments: 2024-05-19T21:10:15.9316635Z ##[debug] account 2024-05-19T21:10:15.9317511Z ##[debug] account 2024-05-19T21:10:15.9324056Z ##[debug] clear 2024-05-19T21:10:15.9325047Z ##[debug] clear 2024-05-19T21:10:15.9325781Z [command]/usr/bin/az account clear 2024-05-19T21:10:16.5795278Z ##[section]Finishing: Provision Resource Group

v-schhabra commented 3 months ago

@jakerosedatacom We are checking on the issue above and will share the updates soon.

v-schhabra commented 3 months ago

@jakerosedatacom we have modified your script https://gist.github.com/DmitriiBobreshev/221c9dc5ac7d8348b7ff50c4b1347990. Could you try to use this script and check if your task is working fine?

jakerosedatacom commented 3 months ago

@v-schhabra , I tried that new script and got a very similar looking error message

2024-05-28T04:25:46.5352575Z ##[debug]Evaluating condition for step: 'Provision Resource Group' 2024-05-28T04:25:46.5355901Z ##[debug]Evaluating: SucceededNode() 2024-05-28T04:25:46.5356528Z ##[debug]Evaluating SucceededNode: 2024-05-28T04:25:46.5357257Z ##[debug]=> True 2024-05-28T04:25:46.5357869Z ##[debug]Result: True 2024-05-28T04:25:46.5359855Z ##[section]Starting: Provision Resource Group 2024-05-28T04:25:46.5366342Z ============================================================================== 2024-05-28T04:25:46.5366991Z Task : Azure CLI 2024-05-28T04:25:46.5367293Z Description : Run Azure CLI commands against an Azure subscription in a PowerShell Core/Shell script when running on Linux agent or PowerShell/PowerShell Core/Batch script when running on Windows agent. 2024-05-28T04:25:46.5367739Z Version : 2.239.4 2024-05-28T04:25:46.5367989Z Author : Microsoft Corporation 2024-05-28T04:25:46.5368251Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-cli 2024-05-28T04:25:46.5368594Z ============================================================================== 2024-05-28T04:25:46.6628896Z ##[debug]Using node path: /home/vsts/agents/3.239.1/externals/node16/bin/node 2024-05-28T04:25:46.7874072Z ##[debug]agent.TempDirectory=/home/vsts/work/_temp 2024-05-28T04:25:46.7892875Z ##[debug]loading inputs and endpoints 2024-05-28T04:25:46.7902528Z ##[debug]loading INPUT_CONNECTEDSERVICENAMEARM 2024-05-28T04:25:46.7920423Z ##[debug]loading INPUT_SCRIPTTYPE 2024-05-28T04:25:46.7925479Z ##[debug]loading INPUT_SCRIPTLOCATION 2024-05-28T04:25:46.7930738Z ##[debug]loading INPUT_SCRIPTPATH 2024-05-28T04:25:46.7934554Z ##[debug]loading INPUT_SCRIPTARGUMENTS 2024-05-28T04:25:46.7939583Z ##[debug]loading INPUT_POWERSHELLERRORACTIONPREFERENCE 2024-05-28T04:25:46.7945946Z ##[debug]loading INPUT_ADDSPNTOENVIRONMENT 2024-05-28T04:25:46.7952567Z ##[debug]loading INPUT_USEGLOBALCONFIG 2024-05-28T04:25:46.7956877Z ##[debug]loading INPUT_CWD 2024-05-28T04:25:46.7963459Z ##[debug]loading INPUT_FAILONSTANDARDERROR 2024-05-28T04:25:46.7970822Z ##[debug]loading INPUT_POWERSHELLIGNORELASTEXITCODE 2024-05-28T04:25:46.7978690Z ##[debug]loading INPUT_VISIBLEAZLOGIN 2024-05-28T04:25:46.7985654Z ##[debug]loading ENDPOINTAUTH 2024-05-28T04:25:46.7994315Z ##[debug]loading ENDPOINT_AUTHSCHEME 2024-05-28T04:25:46.7998295Z ##[debug]loading ENDPOINT_AUTHPARAMETER_SERVICEPRINCIPALID 2024-05-28T04:25:46.8002184Z ##[debug]loading ENDPOINT_AUTHPARAMETER_AUTHENTICATIONTYPE 2024-05-28T04:25:46.8005425Z ##[debug]loading ENDPOINT_AUTHPARAMETER_TENANTID 2024-05-28T04:25:46.8009819Z ##[debug]loading ENDPOINT_AUTHPARAMETER_SERVICEPRINCIPALKEY 2024-05-28T04:25:46.8011347Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION 2024-05-28T04:25:46.8014609Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION 2024-05-28T04:25:46.8017801Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN 2024-05-28T04:25:46.8029159Z ##[debug]loading SECRET_CLIENT_SECRET 2024-05-28T04:25:46.8030359Z ##[debug]loading SECRET_ADF_SHARED_IR_USER 2024-05-28T04:25:46.8034085Z ##[debug]loading SECRET_SYSTEM_ACCESSTOKEN 2024-05-28T04:25:46.8035223Z ##[debug]loading SECRET_ADF_SHARED_IR_KEY 2024-05-28T04:25:46.8036651Z ##[debug]loading SECRET_DLS_KEY 2024-05-28T04:25:46.8037577Z ##[debug]loading SECRET_DLS_ENDPOINT 2024-05-28T04:25:46.8038445Z ##[debug]loaded 27 2024-05-28T04:25:46.8039315Z ##[debug]Agent.ProxyUrl=undefined 2024-05-28T04:25:46.8040249Z ##[debug]Agent.CAInfo=undefined 2024-05-28T04:25:46.8041550Z ##[debug]Agent.ClientCert=undefined 2024-05-28T04:25:46.8042560Z ##[debug]Agent.SkipCertValidation=undefined 2024-05-28T04:25:47.0265376Z ##[debug]check path : /home/vsts/work/_tasks/AzureCLI_46e4be58-730b-4389-8a2f-ea10b3e5e815/2.239.4/task.json 2024-05-28T04:25:47.0267935Z ##[debug]adding resource file: /home/vsts/work/_tasks/AzureCLI_46e4be58-730b-4389-8a2f-ea10b3e5e815/2.239.4/task.json 2024-05-28T04:25:47.0269825Z ##[debug]system.culture=en-US 2024-05-28T04:25:47.0287388Z ##[debug]which 'az' 2024-05-28T04:25:47.0301356Z ##[debug]found: '/usr/bin/az' 2024-05-28T04:25:47.0312051Z ##[debug]scriptType=pscore 2024-05-28T04:25:47.0313959Z ##[debug]scriptLocation=scriptPath 2024-05-28T04:25:47.0317903Z ##[debug]scriptArguments=-subscription_id -rg_groupname -rg_location australiaeast -aad_group 2024-05-28T04:25:47.0322068Z ##[debug]powerShellErrorActionPreference=stop 2024-05-28T04:25:47.0323409Z ##[debug]Agent.Version=3.239.1 2024-05-28T04:25:47.0324479Z ##[debug]Agent.TempDirectory=/home/vsts/work/_temp 2024-05-28T04:25:47.0327603Z ##[debug]scriptPath=/home/vsts/work/1/s/DeploymentArtifacts/resources/01 - Resource group.ps1 2024-05-28T04:25:47.0331425Z ##[debug]powerShellIgnoreLASTEXITCODE=false 2024-05-28T04:25:47.0342487Z ##[debug]which 'pwsh' 2024-05-28T04:25:47.0349938Z ##[debug]found: '/usr/bin/pwsh' 2024-05-28T04:25:47.0351207Z ##[debug]which '/usr/bin/pwsh' 2024-05-28T04:25:47.0352172Z ##[debug]found: '/usr/bin/pwsh' 2024-05-28T04:25:47.0353854Z ##[debug]/usr/bin/pwsh arg: -NoLogo 2024-05-28T04:25:47.0358088Z ##[debug]/usr/bin/pwsh arg: -NoProfile 2024-05-28T04:25:47.0359149Z ##[debug]/usr/bin/pwsh arg: -NonInteractive 2024-05-28T04:25:47.0363402Z ##[debug]/usr/bin/pwsh arg: -ExecutionPolicy 2024-05-28T04:25:47.0364359Z ##[debug]/usr/bin/pwsh arg: Unrestricted 2024-05-28T04:25:47.0368521Z ##[debug]/usr/bin/pwsh arg: -Command 2024-05-28T04:25:47.0369510Z ##[debug]/usr/bin/pwsh arg: . '/home/vsts/work/_temp/azureclitaskscript1716870347033.ps1' 2024-05-28T04:25:47.0370737Z ##[debug]cwd=/home/vsts/work/1/s 2024-05-28T04:25:47.0372019Z ##[debug]scriptLocation=scriptPath 2024-05-28T04:25:47.0373011Z ##[debug]failOnStandardError=false 2024-05-28T04:25:47.0373889Z ##[debug]testing directory '/home/vsts/work/1/s' 2024-05-28T04:25:47.0395682Z ##[debug]which 'az' 2024-05-28T04:25:47.0399798Z ##[debug]found: '/usr/bin/az' 2024-05-28T04:25:47.0401137Z ##[debug]/usr/bin/az arg: --version 2024-05-28T04:25:47.0402160Z ##[debug]/usr/bin/az arg: --version 2024-05-28T04:25:47.0403769Z ##[debug]exec tool: /usr/bin/az 2024-05-28T04:25:47.0404664Z ##[debug]exec tool: /usr/bin/az 2024-05-28T04:25:47.0405560Z ##[debug]arguments: 2024-05-28T04:25:47.0406617Z ##[debug]arguments: 2024-05-28T04:25:47.0407921Z ##[debug] --version 2024-05-28T04:25:47.0408670Z ##[debug] --version 2024-05-28T04:25:47.0411972Z [command]/usr/bin/az --version 2024-05-28T04:25:48.0115165Z WARNING: You have 2 update(s) available. Consider updating your CLI installation with 'az upgrade' 2024-05-28T04:25:48.0116048Z azure-cli 2.60.0 2024-05-28T04:25:48.0118341Z 2024-05-28T04:25:48.0119319Z core 2.60.0 2024-05-28T04:25:48.0120549Z telemetry 1.1.0 2024-05-28T04:25:48.0121012Z 2024-05-28T04:25:48.0121332Z Extensions: 2024-05-28T04:25:48.0121777Z azure-devops 1.0.1 2024-05-28T04:25:48.0121926Z 2024-05-28T04:25:48.0122144Z Dependencies: 2024-05-28T04:25:48.0122422Z msal 1.28.0 2024-05-28T04:25:48.0122790Z azure-mgmt-resource 23.1.0b2 2024-05-28T04:25:48.0122973Z 2024-05-28T04:25:48.0123303Z Python location '/opt/az/bin/python3' 2024-05-28T04:25:48.0123705Z Extensions directory '/opt/az/azcliextensions' 2024-05-28T04:25:48.0123881Z 2024-05-28T04:25:48.0124217Z Python (Linux) 3.11.8 (main, Apr 24 2024, 04:14:09) [GCC 11.4.0] 2024-05-28T04:25:48.0124453Z 2024-05-28T04:25:48.0124726Z Legal docs and information: aka.ms/AzureCliLegal 2024-05-28T04:25:48.0124897Z 2024-05-28T04:25:48.0125042Z 2024-05-28T04:25:48.0194239Z ##[debug]useGlobalConfig=false 2024-05-28T04:25:48.0195930Z ##[debug]Agent.TempDirectory=/home/vsts/work/_temp 2024-05-28T04:25:48.0196759Z ##[debug]Agent.TempDirectory=/home/vsts/work/_temp 2024-05-28T04:25:48.0197473Z Setting AZURE_CONFIG_DIR env variable to: /home/vsts/work/_temp/.azclitask 2024-05-28T04:25:48.0199161Z ##[debug]connectedServiceNameARM= 2024-05-28T04:25:48.0199794Z ##[debug] data environment = AzureCloud 2024-05-28T04:25:48.0200209Z Setting active cloud to: AzureCloud 2024-05-28T04:25:48.0200622Z ##[debug]which 'az' 2024-05-28T04:25:48.0201105Z ##[debug]found: '/usr/bin/az' 2024-05-28T04:25:48.0201625Z ##[debug]/usr/bin/az arg: cloud set -n AzureCloud 2024-05-28T04:25:48.0202142Z ##[debug]/usr/bin/az arg: cloud set -n AzureCloud 2024-05-28T04:25:48.0203144Z ##[debug]exec tool: /usr/bin/az 2024-05-28T04:25:48.0203618Z ##[debug]exec tool: /usr/bin/az 2024-05-28T04:25:48.0204536Z ##[debug]arguments: 2024-05-28T04:25:48.0205246Z ##[debug]arguments: 2024-05-28T04:25:48.0205775Z ##[debug] cloud 2024-05-28T04:25:48.0206296Z ##[debug] cloud 2024-05-28T04:25:48.0206809Z ##[debug] set 2024-05-28T04:25:48.0207322Z ##[debug] set 2024-05-28T04:25:48.0207829Z ##[debug] -n 2024-05-28T04:25:48.0208351Z ##[debug] -n 2024-05-28T04:25:48.0208806Z ##[debug] AzureCloud 2024-05-28T04:25:48.0209330Z ##[debug] AzureCloud 2024-05-28T04:25:48.0209896Z [command]/usr/bin/az cloud set -n AzureCloud 2024-05-28T04:25:48.4795731Z ##[debug]connectedServiceNameARM= 2024-05-28T04:25:48.4796818Z ##[debug] auth scheme = ServicePrincipal 2024-05-28T04:25:48.4798067Z ##[debug] data SubscriptionID = 2024-05-28T04:25:48.4798741Z ##[debug]visibleAzLogin=true 2024-05-28T04:25:48.4799379Z ##[debug] auth param authenticationType = spnKey 2024-05-28T04:25:48.4800133Z ##[debug] auth param serviceprincipalid = 2024-05-28T04:25:48.4800866Z ##[debug] auth param tenantid = 2024-05-28T04:25:48.4801629Z ##[debug]key based endpoint 2024-05-28T04:25:48.4802309Z ##[debug] auth param serviceprincipalkey = 2024-05-28T04:25:48.4804053Z ##[debug]Processed: ##vso[task.setsecret] 2024-05-28T04:25:48.4804738Z ##[debug]which 'az' 2024-05-28T04:25:48.4805453Z ##[debug]found: '/usr/bin/az' 2024-05-28T04:25:48.4806704Z ##[debug]/usr/bin/az arg: login --service-principal -u "" --password= --tenant "" --allow-no-subscriptions 2024-05-28T04:25:48.4808088Z ##[debug]/usr/bin/az arg: login --service-principal -u "" --password= --tenant "" --allow-no-subscriptions 2024-05-28T04:25:48.4808767Z ##[debug]exec tool: /usr/bin/az 2024-05-28T04:25:48.4809323Z ##[debug]exec tool: /usr/bin/az 2024-05-28T04:25:48.4810166Z ##[debug]arguments: 2024-05-28T04:25:48.4810712Z ##[debug]arguments: 2024-05-28T04:25:48.4811235Z ##[debug] login 2024-05-28T04:25:48.4811756Z ##[debug] login 2024-05-28T04:25:48.4812292Z ##[debug] --service-principal 2024-05-28T04:25:48.4812872Z ##[debug] --service-principal 2024-05-28T04:25:48.4813898Z ##[debug] -u 2024-05-28T04:25:48.4814745Z ##[debug] -u 2024-05-28T04:25:48.4815640Z ##[debug] 2024-05-28T04:25:48.4816561Z ##[debug] 2024-05-28T04:25:48.4817165Z ##[debug] --password= 2024-05-28T04:25:48.4817955Z ##[debug] --password= 2024-05-28T04:25:48.4818928Z ##[debug] --tenant 2024-05-28T04:25:48.4819462Z ##[debug] --tenant 2024-05-28T04:25:48.4820013Z ##[debug] 2024-05-28T04:25:48.4820617Z ##[debug] 2024-05-28T04:25:48.4821204Z ##[debug] --allow-no-subscriptions 2024-05-28T04:25:48.4821762Z ##[debug] --allow-no-subscriptions 2024-05-28T04:25:48.4822850Z [command]/usr/bin/az login --service-principal -u --password= --tenant --allow-no-subscriptions 2024-05-28T04:25:49.8034416Z [ 2024-05-28T04:25:49.8069388Z { 2024-05-28T04:25:49.8070475Z "cloudName": "AzureCloud", 2024-05-28T04:25:49.8072051Z "homeTenantId": "", 2024-05-28T04:25:49.8073238Z "id": "", 2024-05-28T04:25:49.8074169Z "isDefault": true, 2024-05-28T04:25:49.8074721Z "managedByTenants": [], 2024-05-28T04:25:49.8075000Z "name": "", 2024-05-28T04:25:49.8075244Z "state": "Enabled", 2024-05-28T04:25:49.8075737Z "tenantId": "", 2024-05-28T04:25:49.8076025Z "user": { 2024-05-28T04:25:49.8076466Z "name": "", 2024-05-28T04:25:49.8076731Z "type": "servicePrincipal" 2024-05-28T04:25:49.8076958Z } 2024-05-28T04:25:49.8077153Z } 2024-05-28T04:25:49.8077349Z ] 2024-05-28T04:25:49.8077937Z ##[debug]which 'az' 2024-05-28T04:25:49.8078439Z ##[debug]found: '/usr/bin/az' 2024-05-28T04:25:49.8078985Z ##[debug]/usr/bin/az arg: account set --subscription "" 2024-05-28T04:25:49.8079589Z ##[debug]/usr/bin/az arg: account set --subscription "" 2024-05-28T04:25:49.8080126Z ##[debug]exec tool: /usr/bin/az 2024-05-28T04:25:49.8080593Z ##[debug]exec tool: /usr/bin/az 2024-05-28T04:25:49.8081049Z ##[debug]arguments: 2024-05-28T04:25:49.8081496Z ##[debug]arguments: 2024-05-28T04:25:49.8081943Z ##[debug] account 2024-05-28T04:25:49.8082382Z ##[debug] account 2024-05-28T04:25:49.8082816Z ##[debug] set 2024-05-28T04:25:49.8083257Z ##[debug] set 2024-05-28T04:25:49.8083700Z ##[debug] --subscription 2024-05-28T04:25:49.8084160Z ##[debug] --subscription 2024-05-28T04:25:49.8084645Z ##[debug] 2024-05-28T04:25:49.8085156Z ##[debug] 2024-05-28T04:25:49.8085707Z [command]/usr/bin/az account set --subscription 2024-05-28T04:25:50.4564340Z ##[debug]addSpnToEnvironment=false 2024-05-28T04:25:50.4566035Z ##[debug] auth scheme = ServicePrincipal 2024-05-28T04:25:50.4566976Z ##[debug]exec tool: /usr/bin/pwsh 2024-05-28T04:25:50.4567790Z ##[debug]arguments: 2024-05-28T04:25:50.4568569Z ##[debug] -NoLogo 2024-05-28T04:25:50.4569348Z ##[debug] -NoProfile 2024-05-28T04:25:50.4570149Z ##[debug] -NonInteractive 2024-05-28T04:25:50.4570940Z ##[debug] -ExecutionPolicy 2024-05-28T04:25:50.4571728Z ##[debug] Unrestricted 2024-05-28T04:25:50.4572516Z ##[debug] -Command 2024-05-28T04:25:50.4573354Z ##[debug] . '/home/vsts/work/_temp/azureclitaskscript1716870347033.ps1' 2024-05-28T04:25:50.4574549Z [command]/usr/bin/pwsh -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command . '/home/vsts/work/_temp/azureclitaskscript1716870347033.ps1' 2024-05-28T04:25:51.2479894Z ##[debug]Agent environment resources - Disk: / Available 21423.00 MB out of 74244.00 MB, Memory: Used 896.00 MB out of 6921.00 MB, CPU: Usage 27.40% 2024-05-28T04:25:52.0460160Z 2024-05-28T04:25:52.0467325Z 2024-05-28T04:25:52.0468045Z australiaeast 2024-05-28T04:25:52.0468658Z 2024-05-28T04:25:52.6537692Z { 2024-05-28T04:25:52.6538420Z "environmentName": "AzureCloud", 2024-05-28T04:25:52.6539112Z "homeTenantId": "", 2024-05-28T04:25:52.6539545Z "id": "", 2024-05-28T04:25:52.6539818Z "isDefault": true, 2024-05-28T04:25:52.6540065Z "managedByTenants": [], 2024-05-28T04:25:52.6540615Z "name": "", 2024-05-28T04:25:52.6540920Z "state": "Enabled", 2024-05-28T04:25:52.6541431Z "tenantId": "", 2024-05-28T04:25:52.6541852Z "user": { 2024-05-28T04:25:52.6542382Z "name": "", 2024-05-28T04:25:52.6542784Z "type": "servicePrincipal" 2024-05-28T04:25:52.6543164Z } 2024-05-28T04:25:52.6543406Z } 2024-05-28T04:25:56.2568312Z ##[debug]Agent environment resources - Disk: / Available 21423.00 MB out of 74244.00 MB, Memory: Used 910.00 MB out of 6921.00 MB, CPU: Usage 24.15% 2024-05-28T04:26:01.2603569Z ##[debug]Agent environment resources - Disk: / Available 21423.00 MB out of 74244.00 MB, Memory: Used 951.00 MB out of 6921.00 MB, CPU: Usage 21.60% 2024-05-28T04:26:06.2634705Z ##[debug]Agent environment resources - Disk: / Available 21371.00 MB out of 74244.00 MB, Memory: Used 978.00 MB out of 6921.00 MB, CPU: Usage 19.57% 2024-05-28T04:26:10.0587284Z WARNING: Interactive authentication is not supported in this session, please run cmdlet 'Connect-AzAccount -UseDeviceAuthentication'. 2024-05-28T04:26:11.5551819Z ##[debug]Agent environment resources - Disk: / Available 21371.00 MB out of 74244.00 MB, Memory: Used 1034.00 MB out of 6921.00 MB, CPU: Usage 17.77% 2024-05-28T04:26:14.0347544Z { 2024-05-28T04:26:14.0349312Z "id": "/subscriptions//resourceGroups/", 2024-05-28T04:26:14.0350331Z "location": "australiaeast", 2024-05-28T04:26:14.0351011Z "managedBy": null, 2024-05-28T04:26:14.0351766Z "name": "", 2024-05-28T04:26:14.0352445Z "properties": { 2024-05-28T04:26:14.0353455Z "provisioningState": "Succeeded" 2024-05-28T04:26:14.0353884Z }, 2024-05-28T04:26:14.0354281Z "tags": null, 2024-05-28T04:26:14.0354934Z "type": "Microsoft.Resources/resourceGroups" 2024-05-28T04:26:14.0355400Z } 2024-05-28T04:26:16.5603274Z ##[debug]Agent environment resources - Disk: / Available 21371.00 MB out of 74244.00 MB, Memory: Used 1007.00 MB out of 6921.00 MB, CPU: Usage 16.35% 2024-05-28T04:26:21.5621113Z ##[debug]Agent environment resources - Disk: / Available 21371.00 MB out of 74244.00 MB, Memory: Used 1007.00 MB out of 6921.00 MB, CPU: Usage 15.17% 2024-05-28T04:26:26.5634582Z ##[debug]Agent environment resources - Disk: / Available 21371.00 MB out of 74244.00 MB, Memory: Used 1007.00 MB out of 6921.00 MB, CPU: Usage 14.13% 2024-05-28T04:26:31.5674571Z ##[debug]Agent environment resources - Disk: / Available 21371.00 MB out of 74244.00 MB, Memory: Used 1008.00 MB out of 6921.00 MB, CPU: Usage 13.29% 2024-05-28T04:26:36.5699706Z ##[debug]Agent environment resources - Disk: / Available 21371.00 MB out of 74244.00 MB, Memory: Used 1009.00 MB out of 6921.00 MB, CPU: Usage 12.50% 2024-05-28T04:26:41.5715716Z ##[debug]Agent environment resources - Disk: / Available 21371.00 MB out of 74244.00 MB, Memory: Used 1009.00 MB out of 6921.00 MB, CPU: Usage 11.82% 2024-05-28T04:26:45.7834596Z Az.MSGraph.internal\Get-AzAdGroup : The context is invalid. Please login using Connect-AzAccount. 2024-05-28T04:26:45.7835985Z At /home/vsts/.local/share/powershell/Modules/Az.Resources/7.1.0/MSGraph.Autorest/custom/Get-AzADGroup.ps1:179 char:9 2024-05-28T04:26:45.7836745Z + Az.MSGraph.internal\Get-AzAdGroup @PSBoundParameters 2024-05-28T04:26:45.7837866Z + ~~~~~~~~~~~~ 2024-05-28T04:26:45.7840429Z + CategoryInfo : NotSpecified: (:) [Get-AzADGroup_List], InvalidOperationException 2024-05-28T04:26:45.7841126Z + FullyQualifiedErrorId : Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Cmdlets.GetAzADGroup_List 2024-05-28T04:26:45.9091551Z ##[debug]Exit code 1 received from tool '/usr/bin/pwsh' 2024-05-28T04:26:45.9096741Z ##[debug]STDIO streams have closed for tool '/usr/bin/pwsh' 2024-05-28T04:26:45.9114054Z ##[debug]task result: Failed 2024-05-28T04:26:45.9155033Z ##[error]Script failed with exit code: 1 2024-05-28T04:26:45.9166963Z ##[debug]Processed: ##vso[task.issue type=error;source=TaskInternal;]Script failed with exit code: 1 2024-05-28T04:26:45.9170487Z ##[debug]Processed: ##vso[task.complete result=Failed;]Script failed with exit code: 1 2024-05-28T04:26:45.9171914Z ##[debug]which 'az' 2024-05-28T04:26:45.9172991Z ##[debug]found: '/usr/bin/az' 2024-05-28T04:26:45.9174263Z ##[debug]/usr/bin/az arg: account clear 2024-05-28T04:26:45.9176178Z ##[debug]/usr/bin/az arg: account clear 2024-05-28T04:26:45.9177696Z ##[debug]exec tool: /usr/bin/az 2024-05-28T04:26:45.9181059Z ##[debug]exec tool: /usr/bin/az 2024-05-28T04:26:45.9182602Z ##[debug]arguments: 2024-05-28T04:26:45.9184185Z ##[debug]arguments: 2024-05-28T04:26:45.9185471Z ##[debug] account 2024-05-28T04:26:45.9186617Z ##[debug] account 2024-05-28T04:26:45.9187905Z ##[debug] clear 2024-05-28T04:26:45.9188938Z ##[debug] clear 2024-05-28T04:26:45.9189802Z [command]/usr/bin/az account clear 2024-05-28T04:26:46.5828611Z ##[debug]Agent environment resources - Disk: / Available 21368.00 MB out of 74244.00 MB, Memory: Used 873.00 MB out of 6921.00 MB, CPU: Usage 11.22% 2024-05-28T04:26:46.5950973Z ##[section]Finishing: Provision Resource Group

v-schhabra commented 3 months ago

Hi @jakerosedatacom The script that is shared (https://gist.github.com/DmitriiBobreshev/221c9dc5ac7d8348b7ff50c4b1347990#file-example-ps1-L25) does not contain auth data and you need to set it by yourself. for example (https://learn.microsoft.com/en-us/powershell/module/az.accounts/connect-azaccount?view=azps-12.0.0#example-3-connect-to-azure-using-a-service-principal-account).

jakerosedatacom commented 3 months ago

Is it expected behaviour in the AzureCli@2 update that I should now have to login using Connect-AzAccount? It used to work before without the Connect-AzAccount command. Is there anywhere to see documentation about these changes so we can track changes that will break functionality?

And if it is expected behaviour, why does the AzurePowershell@5 task not require me to use Connect-AzAccount? Will this also change at some point to require the use of Connect-AzAccount?