-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
Example on a SQL API account with one region, no multi-master, one database without provisioned throughput, one container with provisioned throughput
$container = Get-AzCosmosDBSqlContainer -ResourceGroupName myResourceGroup -AccountName pz-cdb-sql -DatabaseName myDatabase -Name myContainer
Yields
Get-AzCosmosDBSqlContainer: Object reference not set to an instance of an object.
Running above cmdlet with -Debug yields
$container = Get-AzCosmosDBSqlContainer -ResourceGroupName myResourceGroup -AccountName pz-cdb-sql -DatabaseName myDatabase -Name myContainer -Debug
DEBUG: 11:56:58 AM - GetAzCosmosDBSqlContainer begin processing with ParameterSet 'ByNameParameterSet'.
DEBUG: 11:56:58 AM - using account id 'paelaz@microsoft.com'...
DEBUG: [Common.Authentication]: Authenticating using Account: 'paelaz@microsoft.com', environment: 'AzureCloud', tenant: '72f988bf-86f1-41af-91ab-2d7cd011db47'
DEBUG: [Common.Authentication]: Authenticating using configuration values: Domain: '72f988bf-86f1-41af-91ab-2d7cd011db47', Endpoint: 'https://login.microsoftonline.com/', ClientId: '1950a258-227b-4e31-a9cf-717495945fc2', ClientRedirect: 'urn:ietf:wg:oauth:2.0:oob', ResourceClientUri: 'https://management.core.windows.net/', ValidateAuthority: 'True'
DEBUG: [Common.Authentication]: Acquiring token using context with Authority 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/', CorrelationId: '00000000-0000-0000-0000-000000000000', ValidateAuthority: 'True'
DEBUG: [Common.Authentication]: Acquiring token using AdalConfiguration with Domain: '72f988bf-86f1-41af-91ab-2d7cd011db47', AdEndpoint: 'https://login.microsoftonline.com/', ClientId: '1950a258-227b-4e31-a9cf-717495945fc2', ClientRedirectUri: urn:ietf:wg:oauth:2.0:oob
DEBUG: [ADAL]: Information: 2020-03-20T15:56:58.3734859Z: 099927c1-0db7-4795-aaff-e92e16bca26c - LoggerBase.cs: ADAL PCL.CoreCLR with assembly version '3.19.2.6005', file version '3.19.50302.0130' and informational version '2a8bec6c4c76d0c1ef819b55bdc3cda2d2605056' is running...
DEBUG: [ADAL]: Information: 2020-03-20T15:56:58.3736516Z: 099927c1-0db7-4795-aaff-e92e16bca26c - LoggerBase.cs: ADAL PCL.CoreCLR with assembly version '3.19.2.6005', file version '3.19.50302.0130' and informational version '2a8bec6c4c76d0c1ef819b55bdc3cda2d2605056' is running...
DEBUG: [ADAL]: Information: 2020-03-20T15:56:58.3738340Z: 099927c1-0db7-4795-aaff-e92e16bca26c - LoggerBase.cs: === Token Acquisition started:
CacheType: null
Authentication Target: User
, Authority Host: login.microsoftonline.com
DEBUG: [ADAL]: Information: 2020-03-20T15:56:58.3739524Z: 099927c1-0db7-4795-aaff-e92e16bca26c - LoggerBase.cs: === Token Acquisition started:
Authority: https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/
Resource: https://management.core.windows.net/
ClientId: 1950a258-227b-4e31-a9cf-717495945fc2
CacheType: null
Authentication Target: User
DEBUG: [ADAL]: Verbose: 2020-03-20T15:56:58.3740906Z: 099927c1-0db7-4795-aaff-e92e16bca26c - LoggerBase.cs: Loading from cache.
DEBUG: [ADAL]: Verbose: 2020-03-20T15:56:58.3741639Z: 099927c1-0db7-4795-aaff-e92e16bca26c - LoggerBase.cs: Loading from cache.
DEBUG: [ADAL]: Information: 2020-03-20T15:56:58.3851779Z: 00000000-0000-0000-0000-000000000000 - LoggerBase.cs: Deserialized 5 items to token cache.
DEBUG: [ADAL]: Verbose: 2020-03-20T15:56:58.3853854Z: 099927c1-0db7-4795-aaff-e92e16bca26c - LoggerBase.cs: Looking up cache for a token...
DEBUG: [ADAL]: Verbose: 2020-03-20T15:56:58.3855073Z: 099927c1-0db7-4795-aaff-e92e16bca26c - LoggerBase.cs: Looking up cache for a token...
DEBUG: [ADAL]: Information: 2020-03-20T15:56:58.3856271Z: 099927c1-0db7-4795-aaff-e92e16bca26c - LoggerBase.cs: An item matching the requested resource was found in the cache
DEBUG: [ADAL]: Information: 2020-03-20T15:56:58.3857346Z: 099927c1-0db7-4795-aaff-e92e16bca26c - LoggerBase.cs: An item matching the requested resource was found in the cache
DEBUG: [ADAL]: Information: 2020-03-20T15:56:58.3858890Z: 099927c1-0db7-4795-aaff-e92e16bca26c - LoggerBase.cs: 12.641452061666667 minutes left until token in cache expires
DEBUG: [ADAL]: Information: 2020-03-20T15:56:58.3860021Z: 099927c1-0db7-4795-aaff-e92e16bca26c - LoggerBase.cs: 12.641452061666667 minutes left until token in cache expires
DEBUG: [ADAL]: Information: 2020-03-20T15:56:58.3860982Z: 099927c1-0db7-4795-aaff-e92e16bca26c - LoggerBase.cs: A matching item (access token or refresh token or both) was found in the cache
DEBUG: [ADAL]: Information: 2020-03-20T15:56:58.3862408Z: 099927c1-0db7-4795-aaff-e92e16bca26c - LoggerBase.cs: A matching item (access token or refresh token or both) was found in the cache
DEBUG: [ADAL]: Information: 2020-03-20T15:56:58.3865247Z: 099927c1-0db7-4795-aaff-e92e16bca26c - LoggerBase.cs: === Token Acquisition finished successfully. An access token was returned: Expiration Time: 3/20/2020 4:09:36 PM +00:00
DEBUG: [ADAL]: Information: 2020-03-20T15:56:58.3866493Z: 099927c1-0db7-4795-aaff-e92e16bca26c - LoggerBase.cs: === Token Acquisition finished successfully. An access token was returned: Expiration Time: 3/20/2020 4:09:36 PM +00:00Access Token Hash: nu4rcrobCYI9iQ2u26Ik5hYG+UIxAi098uDzPtosB6o=
User id: b995e2c1-f7d9-41c8-a865-c5a7213150b8
DEBUG: [Common.Authentication]: Renewing Token with Type: 'Bearer', Expiry: '03/20/2020 16:09:36 +00:00', MultipleResource? 'True', Tenant: '72f988bf-86f1-41af-91ab-2d7cd011db47', UserId: 'paelaz@microsoft.com'
DEBUG: [Common.Authentication]: User info for token DisplayId: 'paelaz@microsoft.com', Name: Patrick El-Azem, IdProvider: 'https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/', Uid: 'b995e2c1-f7d9-41c8-a865-c5a7213150b8'
DEBUG: [Common.Authentication]: Checking token expiration, token expires '03/20/2020 16:09:36 +00:00' Comparing to '03/20/2020 15:56:58 +00:00' With threshold '00:05:00', calculated time until token expiry: '00:12:38.4853907'
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Headers:
x-ms-client-request-id : c6369217-6854-4ddd-95bc-cf452aee25ba
Accept-Language : en-US
Body:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
OK
Headers:
Cache-Control : no-store, no-cache
Pragma : no-cache
Strict-Transport-Security : max-age=31536000; includeSubDomains
x-ms-gatewayversion : version=2.10.0
Server : Microsoft-HTTPAPI/2.0
x-ms-ratelimit-remaining-subscription-reads: 11988
x-ms-request-id : a91b54a8-d7f1-4932-b5c6-991c6e1ad39d
x-ms-correlation-request-id : a91b54a8-d7f1-4932-b5c6-991c6e1ad39d
x-ms-routing-request-id : CANADACENTRAL:20200320T155658Z:a91b54a8-d7f1-4932-b5c6-991c6e1ad39d
X-Content-Type-Options : nosniff
Date : Fri, 20 Mar 2020 15:56:57 GMT
Body:
{
"id": "/subscriptions/e61e4c75-268b-4c94-ad48-237aa3231481/resourceGroups/myResourceGroup/providers/Microsoft.DocumentDB/databaseAccounts/pz-cdb-sql/sqlDatabases/myDatabase/containers/myContainer",
"type": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers",
"name": "myContainer",
"properties": {
"resource": {
"id": "myContainer",
"indexingPolicy": {
"indexingMode": "consistent",
"automatic": true,
"includedPaths": [
{
"path": "/*"
}
],
"excludedPaths": [
{
"path": "/"_etag"/?"
}
]
},
"partitionKey": {
"paths": [
"/id"
],
"kind": "Hash"
},
"conflictResolutionPolicy": {
"mode": "LastWriterWins",
"conflictResolutionPath": "/_ts",
"conflictResolutionProcedure": ""
},
"geospatialConfig": {
"type": "Geography"
},
"_rid": "Rv1HAITyZjc=",
"_ts": 1584714083,
"_self": "dbs/Rv1HAA==/colls/Rv1HAITyZjc=/",
"_etag": ""0000cc0a-0000-0100-0000-5e74d1630000"",
"_docs": "docs/",
"_sprocs": "sprocs/",
"_triggers": "triggers/",
"_udfs": "udfs/",
"_conflicts": "conflicts/",
"statistics": [
{
"id": "0",
"sizeInKB": 0,
"documentCount": 0,
"partitionKeys": []
}
]
}
}
}
Get-AzCosmosDBSqlContainer: Object reference not set to an instance of an object.
DEBUG: AzureQoSEvent: CommandName - Get-AzCosmosDBSqlContainer; IsSuccess - False; Duration - 00:00:00.6874740;; Exception - System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Azure.Commands.CosmosDB.Models.PSUniqueKeyPolicy..ctor(UniqueKeyPolicy uniqueKey)
at Microsoft.Azure.Commands.CosmosDB.Models.PSSqlContainerGetPropertiesResource..ctor(SqlContainerGetPropertiesResource sqlContainerGetPropertiesResource)
at Microsoft.Azure.Commands.CosmosDB.Models.PSSqlContainerGetResults..ctor(SqlContainerGetResults sqlContainerGetResults)
at Microsoft.Azure.Commands.CosmosDB.GetAzCosmosDBSqlContainer.ExecuteCmdlet()
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord();
DEBUG: Finish sending metric.
DEBUG: 11:56:59 AM - GetAzCosmosDBSqlContainer end processing.