Можно ли использовать Azure CLI в DevOps (размещенном / размещенном на собственном сервере) при подключении с управляемой идентификацией - PullRequest
0 голосов
/ 06 августа 2020

У меня есть небольшой тестовый проект с грубым запуском конвейера на https://github.com/veikkoeeva/dockerservice/blob/main/azure-pipelines.yml. В настоящее время он просто проверяет возможность подключения к Azure, поэтому

trigger:
- master

pool:
  vmImage: windows-latest

steps:
- task: AzureCLI@2
  displayName: Az --version
  inputs:
    azureSubscription: 'TestManagedIdentityConnection'
    scriptType: pscore
    scriptLocation: inlineScript
    inlineScript: |
      az --version

- task: AzureCLI@2
  inputs:
    azureSubscription: 'TestManagedIdentityConnection'
    scriptType: 'pscore'
    scriptLocation: 'scriptPath'
    scriptPath: '$(System.DefaultWorkingDirectory)\devops.ps1'

Но это не удается на этапе входа в систему, например, Azure DevOps failure

The service connection scope is on subscription level. It appears the hosted image tries to connect to an Internal Azure token endpoint. Is there a way to use managed identity that can sign in the CLI using hosted images? What could it look like using self-hosted and managed identity?

This seem to work with "the usual" service principal. But it appears developers are often forbidden to create SPNs to company AD so creating a service connections fails. It appears often it's possible to create a service connection using managed identity, but here we are with this problem. :)

https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest варианты могут быть либо az login --identity или справку. Похоже, что с az login --identity по-прежнему существует та же проблема с вызовом той же конечной точки, что и ранее, и ошибки по той же причине.

...