Skip to content

ERROR: TF400813: The user 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' is not authorized to access this resource. #24108

@arindam0310018

Description

@arindam0310018

Hello Team,

I am trying to create DevOps Service Connection (Type AzureRM) using Azure DevOps Pipelines.
When I am Creating manually running commands using Powershell, it works. But when I am putting it as a Powershell Pipeline Task (In line Script), it throws the below Error:-
ERROR: TF400813: The user 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' is not authorized to access this resource.

Here goes the below details:-

  1. Commands which I ran manually and is successfully Executed -

az devops login
(Will ask for PAT Token)

az devops configure --defaults organization= project=

$passwd="Enter Service Principal Secret"

$env:AZURE_DEVOPS_EXT_AZURE_RM_SERVICE_PRINCIPAL_KEY=$passwd

az devops service-endpoint azurerm create --azure-rm-service-principal-id --azure-rm-subscription-id --azure-rm-subscription-name --azure-rm-tenant-id --name --org --project

az devops service-endpoint list --output table

$id = az devops service-endpoint list --query "[?name==''].id" -o tsv

az devops service-endpoint update --id $id --enable-for-all


  1. Powershell Pipeline Task (In line Script) -

  • task: PowerShell@2
    displayName: CREATE SERVICE CONNECTION IN DEVOPS
    inputs:
    targetType: 'inline'
    script: |
    az devops service-endpoint azurerm create --azure-rm-service-principal-id --azure-rm-subscription-id --azure-rm-subscription-name --azure-rm-tenant-id --name --org --project
    $id = az devops service-endpoint list --query "[?name==''].id" -o tsv
    az devops service-endpoint update --id $id --enable-for-all
    env:
    AZURE_DEVOPS_EXT_AZURE_RM_SERVICE_PRINCIPAL_KEY: "Enter Service Principal Secret"

Can you let me know what is the issue here with the pipeline...

Many Thanks
Regards, Arindam Mitra


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions