简体   繁体   English

AzCosmosDBSqlContainer:“对象引用未设置为 object 的实例。”

[英]AzCosmosDBSqlContainer : “Object reference not set to an instance of an object.”

I am using AzCosmosDBSqlContainer to check details of a CosmosDB (SQL api) container in PowerShell;我正在使用 AzCosmosDBSqlContainer 检查 PowerShell 中 CosmosDB (SQL api) 容器的详细信息; I am getting this error我收到此错误

Object reference not set to an instance of an object Object 引用未设置为 object 的实例

However Get-AzCosmosDBAccount and Get-AzCosmosDBSqlDatabase commands are working fine.但是Get-AzCosmosDBAccountGet-AzCosmosDBSqlDatabase命令工作正常。

Can someone help me with this?有人可以帮我弄这个吗?

Command used:使用的命令:

$ResourceGroup="MyResourceGroup"
$CDBAccountName="mycosmosaccount"
$dbname="myDatabase"
$containername="MyContainer"

$cosmosaccount=Get-AzCosmosDBAccount -ResourceGroupName $ResourceGroup -Name $CDBAccountName 

$cosmosdbname=Get-AzCosmosDBSqlDatabase -AccountName $cosmosaccount.Name -ResourceGroupName $ResourceGroup  -Name $dbname

Get-AzCosmosDBSqlContainer -ResourceGroupName $ResourceGroup -AccountName $cosmosaccount.Name -DatabaseName $cosmosdbname.Name -Name $containername

I found a workaround after getting an update from Microsoft team.在从 Microsoft 团队获得更新后,我找到了解决方法。

https://github.com/Azure/azure-powershell/issues/11381 https://github.com/Azure/azure-powershell/issues/11381

This issue is going to be fixed in upcoming version of Az.CosmosDB 0.1.4此问题将在即将发布的 Az.CosmosDB 0.1.4 版本中修复

Workaround:解决方法:

 Replace "my***Name" with your own values $resourceGroupName = "myResourceGroupName" $accountName = "myAccountName" $databaseName = "mYDatabaseName" $containerName = "myContainerName" $apiVersion = "2020-03-01" $databaseResourceName = $accountName + "/" + $databaseName $containerResourceName = $databaseResourceName + "/" + $containerName $containerResourceType = "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers" Write-Host "List containers in the database" Get-AzResource -ResourceType $containerResourceType -ApiVersion $apiVersion -ResourceGroupName $resourceGroupName -Name $databaseResourceName Write-Host "Show specified container" Get-AzResource -ResourceType $containerResourceType -ApiVersion $apiVersion -ResourceGroupName $resourceGroupName -Name $containerResourceName

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 管道中的条件总是触发“对象引用未设置为 object 的实例。” - Conditional in pipeline always triggering “Object reference not set to an instance of an object.” 更新后,ImageResizer引发“对象引用未设置为对象的实例。” - ImageResizer throws “Object reference not set to an instance of an object.” after update Pyodbc '对象引用未设置为对象的实例。'。 (111213) 带大容量插入 - Pyodbc 'Object reference not set to an instance of an object.'. (111213) with bulk insert pyodbc 发生阻止进一步处理此命令的内部错误:“对象引用未设置为对象的实例。” - pyodbc An internal error occurred that prevents further processing of this command: 'Object reference not set to an instance of an object.' 通过Graph API创建联系人会产生“对象引用未设置为对象实例”。 - Contact creation through Graph API producing “Object reference not set to an instance of an object.” VS2019 登录 azure 时抛出:“未将对象引用设置为对象的实例。” - VS2019 sign in to azure throws: "Object reference not set to an instance of an object." 你调用的对象是空的。 使用TPM设备客户端发送消息时 - Object reference not set to an instance of an object. when sending messages with TPM Device client Azure函数Python blobTrigger如何修复“Microsoft.Azure.WebJobs.Extensions.Storage:对象引用未设置为对象的实例。”? - Azure Functions Python blobTrigger How do I fix “Microsoft.Azure.WebJobs.Extensions.Storage: Object reference not set to an instance of an object.”? CosmosDBTrigger:未将对象引用设置为对象的实例 - CosmosDBTrigger: Object reference not set to an instance of an object Azure PowerShell-对象引用未设置为对象的实例 - Azure PowerShell - Object reference not set to an instance of an object
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM