Azure

Azure CLI venv 설정

whistory 2022. 9. 13. 15:37
반응형



Azure function / VScode 개발환경 설정

  1. 개발할 구독으로 이동
  2. venv 에러

1. 개발할 구독으로 이동

구독 리스트조회

az account list --output table

A few accounts are skipped as they don't have 'Enabled' state. Use '--all' to display them. Name CloudName SubscriptionId State IsDefault


sub-neptune-data AzureCloud 29ff0147-0b60-4de5-9688-4bdd62bb42e0 Enabled False wsseo-MPN-12-01 AzureCloud ae55d6af-7081-4f6d-bd39-682c01fdae84 Enabled False Microsoft Azure AzureCloud 13fb6287-c1c8-4404-811e-2efb86ba4788 Enabled False hanwhadataplatform AzureCloud 4cc88203-2c59-4612-bcd0-8ecbd84db51e Enabled False dMillionsdataplatform AzureCloud 8b3c9a9d-9a60-4d1e-a321-a3cacfe9b09e Enabled True Azure Pass - 스폰서쉽 AzureCloud 96981607-52a1-4c36-bae4-8a146110c807 Enabled False DA-Share-04 AzureCloud 6e6bbc34-ec4a-4ac6-8762-df740e621052 Enabled False

구독변경

az account set --subscription "wsseo-MPN-12-01"

리소스 그룹 리스트조회

az group list

{ "id": "/subscriptions/ae55d6af-7081-4f6d-bd39-682c01fdae84/resourceGroups/test-RG-WS", "location": "koreacentral", "managedBy": null, "name": "test-RG-WS", "properties": { "provisioningState": "Succeeded" }, "tags": {}, "type": "Microsoft.Resources/resourceGroups" }

구독정보조회

az account show

{ "environmentName": "AzureCloud", "homeTenantId": "a74b5451-a280-4768-a5cd-cb47af153c71", "id": "ae55d6af-7081-4f6d-bd39-682c01fdae84", "isDefault": true, "managedByTenants": [], "name": "wsseo-MPN-12-01", "state": "Enabled", "tenantId": "a74b5451-a280-4768-a5cd-cb47af153c71", "user": { "name": "wsseo@cloocus.com", "type": "user" } }

2. venv 설정

rbac 설정

az ad sp create-for-rbac --name localtest-sp-rbac --skip-assignment

The output includes credentials that you must protect. Be sure that you do not include these credentials in your code or check the credentials into your source control. For more information, see https://aka.ms/azadsp-cli 'name' property in the output is deprecated and will be removed in the future. Use 'appId' instead. { "appId": "914d10dc-7c89-4b5a-868e-3335a8478b49", "displayName": "localtest-sp-rbac", "name": "914d10dc-7c89-4b5a-868e-3335a8478b49", "password": "k6BTup-z_pgl_KeieyeZkVGaNDAigsuO9q", "tenant": "a74b5451-a280-4768-a5cd-cb47af153c71" }

set AZURE_SUBSCRIPTION_ID="ae55d6af-7081-4f6d-bd39-682c01fdae84" set AZURE_TENANT_ID=a74b5451-a280-4768-a5cd-cb47af153c71 set AZURE_CLIENT_ID=914d10dc-7c89-4b5a-868e-3335a8478b49 set AZURE_CLIENT_SECRET=k6BTup-z_pgl_KeieyeZkVGaNDAigsuO9q

Anaconda download

https://docs.anaconda.com/anaconda/install/windows/

python -m venv .venv

venv activate 시 권한 에러발생 시

.\.venv\Scripts\activate

.\.venv\Scripts\activate : 이 시스템에서 스크립트를 실행할 수 없으므로 C:\workspace\func-test-ws-002\.venv\Scripts\Activate.ps1 파일을 로드할 수 없습니다. 자세한 내용은 about_Execution_Policies(https://go.microsoft.com/fwlink/?LinkID=135170)를 참조하십시오. 위치 줄:1 문자:1

  • .\.venv\Scripts\activate
  • 
    
  • CategoryInfo : 보안 오류: (:) [], PSSecurityException
  • FullyQualifiedErrorId : UnauthorizedAccess

Set-ExecutionPolicy 로 권한문제 해결

Set-ExecutionPolicy Unrestricted -Scope Process

반응형