admin管理员组文章数量:1300030
Is it possible to use Managed Identity to access a repo in DevOps on az container create
?
I have the following, although the continer hangs on build:
az container create `
--resource-group rgname`
--name con-name `
--location centralus `
--os-type Linux `
--acr-identity $(az identity show --name mi-name --resource-group rg-name --query id --output tsv) `
--assign-identity $(az identity show --name mi-name --resource-group rg-name --query id --output tsv) `
--image acrurl.azurecr.io/img:tag `
--cpu 1 `
--memory 1 `
--restart-policy Never `
--command-line "/bin/bash -c 'cd home/site/repo; git checkout docker-mi; dbt debug'" `
--protocol TCP `
--ports 80 `
--gitrepo-url "; `
--gitrepo-mount-path home/site `
when using, the below I can build and connect the continer fine:
--gitrepo-url "https://azurereposuser:[email protected]//devops/_git/dbtproject" `
--gitrepo-mount-path home/site
I'd like to use MI instead of a token.
Any pointers would be much appreciated
Is it possible to use Managed Identity to access a repo in DevOps on az container create
?
I have the following, although the continer hangs on build:
az container create `
--resource-group rgname`
--name con-name `
--location centralus `
--os-type Linux `
--acr-identity $(az identity show --name mi-name --resource-group rg-name --query id --output tsv) `
--assign-identity $(az identity show --name mi-name --resource-group rg-name --query id --output tsv) `
--image acrurl.azurecr.io/img:tag `
--cpu 1 `
--memory 1 `
--restart-policy Never `
--command-line "/bin/bash -c 'cd home/site/repo; git checkout docker-mi; dbt debug'" `
--protocol TCP `
--ports 80 `
--gitrepo-url "https://dev.azure//devops/_git/dbtproject" `
--gitrepo-mount-path home/site `
when using, the below I can build and connect the continer fine:
--gitrepo-url "https://azurereposuser:[email protected]//devops/_git/dbtproject" `
--gitrepo-mount-path home/site
I'd like to use MI instead of a token.
Any pointers would be much appreciated
Share Improve this question asked Feb 11 at 15:08 marko0omarko0o 758 bronze badges2 Answers
Reset to default 0To use a Managed Identity (MI), to access repositories in Azure DevOps, you need to configure like as below:
In the target Azure DevOps anization, go to "Organization Settings" > "Users" page to add the MI as a user into the anization, and ensure the MI at least has
Basic
access level assigned.Add the MI as a member into the projects where the repositories are in, and ensure the MI at least has
Read
permissions on the repositories.Then you need to acquire an access token for the MI. The details steps to acquire the access token, see "Get a Microsoft Entra ID token".
Then you can use this access token to call Azure DevOps REST API, Azure DevOps CLI, and related
git
commands to access the repositories in the target Azure DevOps anization.
For more details, you can refer to the documentation "Use service principals & managed identities in Azure DevOps".
Thanks for the pointers.
adding the following to get a token did the trick:
$(az account get-access-token --resource 499b84ac-1321-427f-aa17-267ca6975798 --query "accessToken" --output tsv)
I then added the get token as so:
--gitrepo-url "https://azurereposuser:$(az account get-access-token --resource 499b84ac-1321-427f-aa17-267ca6975798 --query "accessToken" --output tsv)@dev.azure//devops/_git/dbtproject"
本文标签: dockerACI mount gitrepourl using Managed Identity from Azure DevOpsStack Overflow
版权声明:本文标题:docker - ACI mount gitrepo-url using Managed Identity from Azure DevOps - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741654216a2390659.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论