Microsoft/Azure

Azcopy 로그인에 App Registration (Service principal) 사용

megapain 2021. 6. 8. 00:47
참고 자료
Download Azcopy - https://docs.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-v10#download-azcopy
azcopy login - https://docs.microsoft.com/en-us/azure/storage/common/storage-ref-azcopy-login

 

Azcopy 로그인을 할 때 웹브라우저에 인증 코드 및 ID/PW를 넣어야 하는데,
Azure Active Directory의 App Registration을 사용하면 Azcopy 로그인을 간소화 할 수 있습니다.

당연히 App Registration을 만들어야 하고, Applicaton ID, Secret, Tenant ID 정보를 알고 있어야 하며, 대상 구독이나 Resource Group 또는 Storage Account에 대하여 Owner 또는 Contributor 권한과 Storage blob data contributor 권한을 가져야 합니다.

 

[Linux]

export AZCOPY_SPA_CLIENT_ID="Application ID"

export AZCOPY_SPA_CLIENT_SECRET="Application Secret"

export AZCOPY_SPA_TENANT_ID="Tenant ID"

 

./azcopy login --service-principal --application-id $AZCOPY_SPA_CLIENT_ID --tenant-id $AZCOPY_SPA_TENANT_ID

 

[Windows]

$env:AZCOPY_SPA_CLIENT_SECRET="Application Secret"

azcopy login `
--service-principal `
--application-id "Application ID" `
--tenant-id "Tenant ID"