ERROR: TF400813: The user 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' is not authorized to access this resource.
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
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
********************************************
2. 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.*
* ID: fa18e6e0-743a-1e6f-23a7-26460e2f9f27
* Version Independent ID: f05be940-a104-7cc4-1cd8-88046d3eac49
* Content: [az devops service-endpoint azurerm](https://learn.microsoft.com/en-us/cli/azure/devops/service-endpoint/azurerm?view=azure-cli-latest#az-devops-service-endpoint-azurerm-create)
* Content Source: [latest/docs-ref-autogen/devops/service-endpoint/azurerm.yml](https://github.com/MicrosoftDocs/azure-docs-cli/blob/main/latest/docs-ref-autogen/devops/service-endpoint/azurerm.yml)
* GitHub Login: @rloutlaw
* Microsoft Alias: **routlaw**
Contributor guide
Assessment
This issue has not been assessed yet.