Skip to content

Invoke-WebRequest with digest #14599

@damianon

Description

@damianon

We have a script that runs just fine on Powershell 5, but when executing on devops agenst running ubuntu and powershell core 7.1 it always fails with a 401 Error.

$Password = ConvertTo-SecureString $MongoAtlasApiKeyPrivate -AsPlainText -Force
$Credentials = New-Object System.Management.Automation.PSCredential ($MongoAtlasApiKeyPublic, $Password)

Invoke-WebRequest -Uri $MongoAtlasApiUrl -Method POST -ContentType "application/json" -Credential $Credentials -Body $json

It's trying to callt he mongo atlas api, which according to mongo's documentation requires digest authentictaion. However I couldn't find anything mentioning digest with Invoke-WebRequest. Onlny Oauth and other auth methods, but nothing about digest. Is it just no possible anymore since PWSH 6/7?

This is the corresponding mongo documentation: https://docs.atlas.mongodb.com/reference/api/whitelist-add-one

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-ExternalThe issue is caused by external component(s).Resolution-FixedThe issue is fixed.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions