Invoke-RestMethod : {"code":"Unauthorized","message":"The input authorization
token can't serve the request. Please check that the expected payload is built
as per the protocol, and check the key being used. Server used the following
payload to sign: 'put\noffers\n{removed}\nmon, 23 apr 2018 15:47:13
gmt\n\n'\r\nActivityId: {removed},
Microsoft.Azure.Documents.Common/1.21.0.0"}
At /usr/local/microsoft/powershell/6.0.0-beta.7/Modules/CosmosDB/2.0.9.364/lib/
utils.ps1:402 char:23
+ $restResult = Invoke-RestMethod @invokeRestMethodParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Method: PUT, Re...ication/jso
n
}:HttpRequestMessage) [Invoke-RestMethod], HttpResponseException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShe
ll.Commands.InvokeRestMethodCommand
The fix seems to be relatively simple and straightforward. There just needs to be a .ToLowerInvariant()
added to the end of Line 327 in the /src/lib/utils.ps1
file.
$PSVersionTable | Format-List
Name : PSVersion
Value : 6.0.0-beta
Name : PSEdition
Value : Core
Name : GitCommitId
Value : v6.0.0-beta.7
Name : OS
Value : Darwin 17.5.0 Darwin Kernel Version 17.5.0: Mon Mar 5 22:24:32 PST
2018; root:xnu-4570.51.1~1/RELEASE_X86_64
Name : Platform
Value : Unix
Name : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0...}
Name : PSRemotingProtocolVersion
Value : 2.3
Name : SerializationVersion
Value : 1.1.0.1
Name : WSManStackVersion
Value : 3.0
Get-Module -Name CosmosDB | Format-List
Name : CosmosDB
Path : /usr/local/microsoft/powershell/6.0.0-beta.7/Modules/Cosmos
DB/2.0.9.364/CosmosDB.psm1
Description : This module provides cmdlets for working with Azure Cosmos
DB databases, collections, documents, attachments, offers,
users, permissions, triggers, stored procedures and user
defined functions.
ModuleType : Script
Version : 2.0.9.364
NestedModules : {}
ExportedFunctions : {Get-CosmosDbAttachment,
Get-CosmosDbAttachmentResourcePath,
Get-CosmosDbCollection,
Get-CosmosDbCollectionResourcePath...}
ExportedCmdlets :
ExportedVariables :
ExportedAliases : New-CosmosDbConnection