Azure CLI 설치 및 로그인
Bash
# Ubuntu / Debian
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
# macOS
brew install azure-cli
# 버전 확인
az --version
# 로그인
az login # 브라우저 인증
az login --use-device-code # 코드 인증 (서버)
# 구독 선택
az account list --output table
az account set --subscription "구독명 또는 ID"
# 현재 컨텍스트
az account show리소스 그룹 생성
Azure의 모든 리소스는 리소스 그룹에 속합니다.
Bash
# 리소스 그룹 생성
az group create --name my-rg --location koreacentral # 한국 중부
# 위치 목록
az account list-locations --output table | grep korea
# 리소스 그룹 목록
az group list --output table
# 리소스 그룹 삭제 (내부 리소스 모두 삭제됨 — 주의)
az group delete --name my-rg --yes --no-wait가상 머신 생성
Bash
# Ubuntu VM 생성
az vm create --resource-group my-rg --name my-vm --image Ubuntu2204 --size Standard_B2s --admin-username azureuser --generate-ssh-keys --location koreacentral
# Windows VM 생성
az vm create --resource-group my-rg --name my-win-vm --image Win2022Datacenter --size Standard_B2s --admin-username azureuser --admin-password "MyP@ssw0rd123"
# VM 목록
az vm list --output table
az vm list -g my-rg --output table
# VM 시작 / 중지 / 재시작
az vm start --resource-group my-rg --name my-vm
az vm stop --resource-group my-rg --name my-vm
az vm restart --resource-group my-rg --name my-vm
# SSH 접속 (공인 IP 확인)
az vm show -g my-rg -n my-vm -d --query publicIps -o tsv네트워크 보안 그룹 (NSG)
Bash
# NSG 생성
az network nsg create --resource-group my-rg --name my-nsg
# 인바운드 규칙 추가
az network nsg rule create --resource-group my-rg --nsg-name my-nsg --name allow-ssh --protocol tcp --direction inbound --priority 100 --source-address-prefix '*' --destination-port-range 22 --access allow
az network nsg rule create --resource-group my-rg --nsg-name my-nsg --name allow-http --protocol tcp --direction inbound --priority 110 --source-address-prefix '*' --destination-port-range 80 --access allow
# NSG를 NIC에 연결
az network nic update --resource-group my-rg --name my-vmVMNic --network-security-group my-nsg가상 네트워크 (VNet)
Bash
# VNet 생성
az network vnet create --resource-group my-rg --name my-vnet --address-prefix 10.0.0.0/16 --location koreacentral
# 서브넷 추가
az network vnet subnet create --resource-group my-rg --vnet-name my-vnet --name public-subnet --address-prefix 10.0.1.0/24
az network vnet subnet create --resource-group my-rg --vnet-name my-vnet --name private-subnet --address-prefix 10.0.2.0/24Azure Blob 스토리지
Bash
# 스토리지 계정 생성
az storage account create --name mystorageaccount1234 --resource-group my-rg --location koreacentral --sku Standard_LRS --kind StorageV2
# 컨테이너(버킷) 생성
az storage container create --name mycontainer --account-name mystorageaccount1234 --public-access off
# 파일 업로드
az storage blob upload --account-name mystorageaccount1234 --container-name mycontainer --file ./myfile.txt --name myfile.txt
# 파일 목록
az storage blob list --account-name mystorageaccount1234 --container-name mycontainer --output table
# 파일 다운로드
az storage blob download --account-name mystorageaccount1234 --container-name mycontainer --name myfile.txt --file ./downloaded.txt비용 절감 팁
- B-시리즈 VM: 개발용 저렴한 버스트형 인스턴스
- 예약 인스턴스: 1년/3년 약정으로 최대 72% 할인
- Spot 인스턴스: 최대 90% 할인, 언제든 중단 가능
- 사용 안 하는 VM은 할당 취소(deallocate) — 중지만 하면 컴퓨팅 요금 계속 발생
Bash
az vm deallocate --resource-group my-rg --name my-vm편집 안내 · Editorial Note
이 가이드는 AI 도구를 활용해 초안을 구성하고 사람이 명령어·문맥을 검토해 발행했습니다. 운영체제와 도구 버전에 따라 결과가 달라질 수 있으므로 적용 전 공식 문서를 함께 확인하세요. 오류를 발견하시면 이메일로 제보해 주세요.
질문 & 답변 (Q&A)
이 가이드에 대해 궁금한 점을 질문해보세요. 확인 후 답변드립니다.