다음을 통해 공유


Azure Cosmos DB - API for Table용 테이블 나열 및 가져오기

적용 대상: 테이블

참고 항목

Azure Az PowerShell 모듈을 사용하여 Azure와 상호 작용하는 것이 좋습니다. 시작하려면 Azure PowerShell 설치를 참조하세요. Az PowerShell 모듈로 마이그레이션하는 방법에 대한 자세한 내용은 Azure PowerShell을 AzureRM에서 Azure로 마이그레이션을 참조하세요.

이 샘플에는 Azure PowerShell Az 5.4.0 이상이 필요합니다. Get-Module -ListAvailable Az를 실행하여 설치된 버전을 확인합니다. 설치해야 하는 경우 Azure PowerShell 모듈 설치를 참조하세요.

Connect-AzAccount를 실행하여 Azure에 로그인합니다.

샘플 스크립트

# Reference: Az.CosmosDB | https://docs.microsoft.com/powershell/module/az.cosmosdb
# --------------------------------------------------
# Purpose
# Show list and get operations for Azure Cosmos DB Table API
# --------------------------------------------------
# Variables - ***** SUBSTITUTE YOUR VALUES *****
$resourceGroupName = "myResourceGroup" # Resource Group must already exist
$accountName = "myaccount" # Must be all lower case
$tableName = "myTable"
# --------------------------------------------------

Write-Host "List all accounts in a resource group"
Get-AzCosmosDBAccount -ResourceGroupName $resourceGroupName

Write-Host "Get an account in a resource group"
Get-AzCosmosDBAccount -ResourceGroupName $resourceGroupName `
    -Name $accountName

Write-Host "List all tables in an account"
Get-AzCosmosDBTable -ResourceGroupName $resourceGroupName `
    -AccountName $accountName

Write-Host "Get a table in an account including throughput"
Get-AzCosmosDBTable -ResourceGroupName $resourceGroupName `
    -AccountName $accountName -Name $tableName

배포 정리

스크립트 샘플을 실행한 후에 다음 명령을 사용하여 리소스 그룹 및 관련된 모든 리소스를 제거할 수 있습니다.

Remove-AzResourceGroup -ResourceGroupName "myResourceGroup"

스크립트 설명

이 스크립트는 다음 명령을 사용합니다. 테이블에 있는 각 명령은 명령에 해당하는 문서에 연결됩니다.

명령 주의
Azure Cosmos DB
Get-AzCosmosDBAccount Azure Cosmos DB 계정을 나열하거나 지정된 Azure Cosmos DB 계정을 가져옵니다.
Get-AzCosmosDBTable 계정의 API for Table 테이블을 나열하거나 계정에 지정된 API for Table 테이블을 가져옵니다.
Azure 리소스 그룹
Remove-AzResourceGroup 모든 중첩 리소스를 포함한 리소스 그룹을 삭제합니다.

다음 단계

Azure PowerShell에 대한 자세한 내용은 Azure PowerShell 설명서를 참조하세요.