MongoDB Atlas与PowerShell的交互
我需要有关MongoDB atlas API与PowerShell连接的帮助。使用bash,它可以完美地工作MongoDB Atlas与PowerShell的交互,mongodb,powershell,Mongodb,Powershell,我需要有关MongoDB atlas API与PowerShell连接的帮助。使用bash,它可以完美地工作 curl --include --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \ --header "Accept: application/json" \ --header "Content-Type: application/json" \ "https
curl --include --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
"https://cloud.mongodb.com/api/atlas/v1.0/orgs/{ORG-ID}?pretty=true"
但是我也想做同样的事情,有人能帮我吗?(@RamanSilopal非常感谢您的链接:) 我已将其转换为PowerShell,如下所示:
$ApiPrivateKey
$ApiPublicKey
$Uri = 'https://cloud.mongodb.com/api/atlas/v1.0/groups/{ORG-ID}/accessList?pretty=true'
[securestring]$secStringPassword = ConvertTo-SecureString $ApiPrivateKey -AsPlainText -Force
[pscredential]$credential = New-Object System.Management.Automation.PSCredential ($ApiPublicKey, $secStringPassword)
Invoke-RestMethod -Uri $Uri -ContentType Application/Json -Headers @{Authorization = “Basic $base64AuthInfo”} -Credential $credential -Method Get
这有帮助吗-嘿@RamanSailopal非常感谢你,是的,它非常有效:D