在 PowerShell 中检查 Cosmos DB 帐户的状态

Check Status of Cosmos DB account in PowerShell

我正在编写一个 PowerShell 脚本,该脚本对 Cosmos DB 帐户执行多个顺序更新。 There is great documentation on how to do this,最后一行提到:

"Check account in Azure portal or using Get-AzCosmosDBAccount for region status."

该功能 returns lots of properties,但其中 none 是门户中显示帐户“在线”或“正在更新”的状态。由于更新 returns 在资源准备好之前,有没有一种方法可以在 PowerShell 中以编程方式检查它,以便我可以在执行下一次更新之前等待?

您要检查的 属性 是 ProvisioningState

来自 REST API 文档 here(搜索 provisioningState 属性):

The status of the Cosmos DB account at the time the operation was called. The status can be one of following.

'Creating' – the Cosmos DB account is being created. When an account is in Creating state, only properties that are specified as input for the Create Cosmos DB account operation are returned.

'Succeeded' – the Cosmos DB account is active for use.

'Updating' – the Cosmos DB account is being updated.

'Deleting' – the Cosmos DB account is being deleted.

'Failed' – the Cosmos DB account failed creation.

'DeletionFailed' – the Cosmos DB account deletion failed.