콘텐츠로 이동

Azure CLI

명령어설명
az loginAzure에 로그인
az login --service-principal -u <app-id> -p <password> --tenant <tenant>서비스 주체로 로그인
az logoutAzure에서 로그아웃
az account list모든 구독 목록
az account set --subscription "subscription-name"활성 구독 설정
az account show현재 구독 표시
az configureAzure CLI 설정 구성
명령어설명
az group list모든 리소스 그룹 나열
az group create --name myResourceGroup --location eastus리소스 그룹 생성
az group delete --name myResourceGroup리소스 그룹 삭제
az group show --name myResourceGroup리소스 그룹 세부 정보 표시
az group update --name myResourceGroup --tags environment=production리소스 그룹 태그 업데이트
명령어설명
az vm list모든 VM 나열하기
az vm create --resource-group myResourceGroup --name myVM --image UbuntuLTS --admin-username azureuser --generate-ssh-keysVM 생성
az vm start --resource-group myResourceGroup --name myVMVM 시작
az vm stop --resource-group myResourceGroup --name myVMVM 중지
az vm restart --resource-group myResourceGroup --name myVMVM 다시 시작
az vm delete --resource-group myResourceGroup --name myVMVM 삭제
az vm deallocate --resource-group myResourceGroup --name myVMVM 할당 해제
명령어설명
az vm show --resource-group myResourceGroup --name myVMVM 세부 정보 표시
az vm list-sizes --location eastus사용 가능한 VM 크기 나열
az vm image list --output table인기 있는 VM 이미지 목록
az vm image list --publisher Canonical --output table게시자별 이미지 목록
az vm get-instance-view --resource-group myResourceGroup --name myVMVM 인스턴스 보기 가져오기
명령어설명
az vm extension list --resource-group myResourceGroup --vm-name myVMVM 확장 목록
az vm extension set --resource-group myResourceGroup --vm-name myVM --name customScript --publisher Microsoft.Azure.Extensions --settings '\\{"fileUris":["https://example.com/script.sh"],"commandToExecute":"sh script.sh"\\}'확장 프로그램 설치
az vm extension delete --resource-group myResourceGroup --vm-name myVM --name customScript확장자 제거
명령어설명
az storage account list저장소 계정 나열
az storage account create --name mystorageaccount --resource-group myResourceGroup --location eastus --sku Standard_LRS스토리지 계정 생성
az storage account delete --name mystorageaccount --resource-group myResourceGroup스토리지 계정 삭제
az storage account show --name mystorageaccount --resource-group myResourceGroup스토리지 계정 세부 정보 표시
az storage account keys list --account-name mystorageaccount --resource-group myResourceGroup저장소 계정 키 나열
명령어설명
az storage container list --account-name mystorageaccount컨테이너 목록
az storage container create --name mycontainer --account-name mystorageaccount컨테이너 생성
az storage container delete --name mycontainer --account-name mystorageaccount컨테이너 삭제
az storage blob upload --file myfile.txt --container-name mycontainer --name myblob --account-name mystorageaccountBlob 업로드
az storage blob download --container-name mycontainer --name myblob --file myfile.txt --account-name mystorageaccountBlob 다운로드
az storage blob list --container-name mycontainer --account-name mystorageaccountBlob 목록
명령어설명
az storage share list --account-name mystorageaccount파일 공유 목록
az storage share create --name myshare --account-name mystorageaccount파일 공유 생성
az storage file upload --share-name myshare --source myfile.txt --account-name mystorageaccount파일 업로드
az storage file download --share-name myshare --path myfile.txt --dest myfile.txt --account-name mystorageaccount파일 다운로드
명령어설명
az webapp list웹 앱 목록
`az webapp create —resource-group myResourceGroup —plan myAppServicePlan —name myWebApp —runtime “NODE14-lts”`
az webapp delete --resource-group myResourceGroup --name myWebApp웹 앱 삭제
az webapp start --resource-group myResourceGroup --name myWebApp웹 앱 시작
az webapp stop --resource-group myResourceGroup --name myWebApp웹 앱 중지
az webapp restart --resource-group myResourceGroup --name myWebApp웹 앱 다시 시작
명령어설명
az appservice plan list앱 서비스 플랜 나열하기
az appservice plan create --name myAppServicePlan --resource-group myResourceGroup --sku B1앱 서비스 플랜 생성
az appservice plan delete --name myAppServicePlan --resource-group myResourceGroup앱 서비스 플랜 삭제
az appservice plan update --name myAppServicePlan --resource-group myResourceGroup --sku S1앱 서비스 플랜 업데이트
명령어설명
az webapp deployment source config --resource-group myResourceGroup --name myWebApp --repo-url https://github.com/user/repo --branch masterGit 배포 구성
az webapp deployment source sync --resource-group myResourceGroup --name myWebApp동기화 배포
az webapp log tail --resource-group myResourceGroup --name myWebApp스트림 로그
az webapp config appsettings set --resource-group myResourceGroup --name myWebApp --settings key=value앱 설정 지정
명령어설명
az functionapp list함수 앱 목록
az functionapp create --resource-group myResourceGroup --consumption-plan-location eastus --runtime node --name myFunctionApp --storage-account mystorageaccount함수 앱 생성
az functionapp delete --resource-group myResourceGroup --name myFunctionApp함수 앱 삭제
az functionapp start --resource-group myResourceGroup --name myFunctionApp함수 앱 시작
az functionapp stop --resource-group myResourceGroup --name myFunctionApp함수 앱 중지
명령어설명
az functionapp function list --resource-group myResourceGroup --name myFunctionApp함수 목록
az functionapp function show --resource-group myResourceGroup --name myFunctionApp --function-name myFunction함수 세부 정보 표시
az functionapp function delete --resource-group myResourceGroup --name myFunctionApp --function-name myFunction삭제 함수
명령어설명
az sql server listSQL 서버 목록
az sql server create --name myserver --resource-group myResourceGroup --location eastus --admin-user myadmin --admin-password myPassword123!SQL 서버 생성
az sql server delete --name myserver --resource-group myResourceGroupSQL 서버 삭제
az sql server show --name myserver --resource-group myResourceGroupSQL 서버 세부 정보 표시
명령어설명
az sql db list --resource-group myResourceGroup --server myserver데이터베이스 목록
az sql db create --resource-group myResourceGroup --server myserver --name mydatabase --service-objective S0데이터베이스 생성
az sql db delete --resource-group myResourceGroup --server myserver --name mydatabase데이터베이스 삭제
az sql db show --resource-group myResourceGroup --server myserver --name mydatabase데이터베이스 세부 정보 표시
명령어설명
az sql server firewall-rule list --resource-group myResourceGroup --server myserver방화벽 규칙 나열
az sql server firewall-rule create --resource-group myResourceGroup --server myserver --name AllowMyIP --start-ip-address 192.168.1.1 --end-ip-address 192.168.1.1방화벽 규칙 생성
az sql server firewall-rule delete --resource-group myResourceGroup --server myserver --name AllowMyIP방화벽 규칙 삭제
명령어설명
az ad user list사용자 목록
az ad user create --display-name "John Doe" --password myPassword123! --user-principal-name john@contoso.com사용자 생성
az ad user delete --id john@contoso.com사용자 삭제
az ad user show --id john@contoso.com사용자 세부 정보 표시
az ad user update --id john@contoso.com --display-name "John Smith"사용자 업데이트
명령어설명
az ad group list그룹 목록
az ad group create --display-name "My Group" --mail-nickname mygroup그룹 생성
az ad group delete --group mygroup그룹 삭제
az ad group member add --group mygroup --member-id john@contoso.com그룹에 멤버 추가
az ad group member remove --group mygroup --member-id john@contoso.com그룹에서 멤버 제거
명령어설명
az ad app list애플리케이션 목록
az ad app create --display-name "My App"애플리케이션 생성
az ad app delete --id <app-id>애플리케이션 삭제
az ad app show --id <app-id>애플리케이션 세부 정보 표시

Azure Kubernetes Service (AKS)

클러스터 관리

명령어설명
az aks listAKS 클러스터 나열하기
az aks create --resource-group myResourceGroup --name myAKSCluster --node-count 1 --enable-addons monitoring --generate-ssh-keysAKS 클러스터 생성
az aks delete --resource-group myResourceGroup --name myAKSClusterAKS 클러스터 삭제
az aks start --resource-group myResourceGroup --name myAKSClusterAKS 클러스터 시작
az aks stop --resource-group myResourceGroup --name myAKSClusterAKS 클러스터 중지

클러스터 운영

명령어설명
az aks get-credentials --resource-group myResourceGroup --name myAKSCluster클러스터 자격 증명 가져오기
az aks scale --resource-group myResourceGroup --name myAKSCluster --node-count 3클러스터 확장
az aks upgrade --resource-group myResourceGroup --name myAKSCluster --kubernetes-version 1.21.1클러스터 업그레이드
az aks show --resource-group myResourceGroup --name myAKSCluster클러스터 세부 정보 표시

Azure Container Registry (ACR)

레지스트리 관리

명령어설명
az acr list컨테이너 레지스트리 목록
az acr create --resource-group myResourceGroup --name myregistry --sku Basic컨테이너 레지스트리 생성
az acr delete --resource-group myResourceGroup --name myregistry컨테이너 레지스트리 삭제
az acr login --name myregistry레지스트리에 로그인

이미지 관리

명령어설명
az acr repository list --name myregistry저장소 목록
az acr repository show-tags --name myregistry --repository myapp이미지 태그 표시
az acr repository delete --name myregistry --repository myapp --tag v1.0이미지 태그 삭제
docker tag myapp:latest myregistry.azurecr.io/myapp:v1.0ACR용 이미지 태그하기
docker push myregistry.azurecr.io/myapp:v1.0ACR에 이미지 푸시

네트워킹

가상 네트워크

명령어설명
az network vnet list가상 네트워크 목록
az network vnet create --resource-group myResourceGroup --name myVNet --address-prefix 10.0.0.0/16가상 네트워크 생성
az network vnet delete --resource-group myResourceGroup --name myVNet가상 네트워크 삭제
az network vnet subnet create --resource-group myResourceGroup --vnet-name myVNet --name mySubnet --address-prefix 10.0.1.0/24서브넷 생성

네트워크 보안 그룹

명령어설명
az network nsg list네트워크 보안 그룹 나열
az network nsg create --resource-group myResourceGroup --name myNSGNSG 생성
az network nsg rule create --resource-group myResourceGroup --nsg-name myNSG --name myRule --protocol tcp --priority 1000 --destination-port-range 80NSG 규칙 생성
az network nsg rule delete --resource-group myResourceGroup --nsg-name myNSG --name myRuleNSG 규칙 삭제

로드 밸런서

명령어설명
az network lb list로드 밸런서 목록
az network lb create --resource-group myResourceGroup --name myLoadBalancer --sku Standard --public-ip-address myPublicIP로드 밸런서 생성
az network lb delete --resource-group myResourceGroup --name myLoadBalancer로드 밸런서 삭제

모니터링 및 로깅

Azure Monitor

명령어설명
az monitor metrics list --resource <resource-id>지표 목록
az monitor metrics list-definitions --resource <resource-id>메트릭 정의 목록
az monitor log-analytics workspace listLog Analytics 작업 영역 나열
az monitor log-analytics workspace create --resource-group myResourceGroup --workspace-name myWorkspace작업 공간 생성

경고

명령어설명
az monitor alert list경고 목록
az monitor alert create --name myAlert --resource-group myResourceGroup --condition "avg Percentage CPU > 80"경고 생성
az monitor alert delete --name myAlert --resource-group myResourceGroup알림 삭제

모범 사례

보안