Description
Describe the bug
Currently when I run
"Add-MgServicePrincipalKey -ServicePrincipalId $spoappid -BodyParameter $params -Verbose"
,
it always shows error “Add-MgServicePrincipalKey : Resource '00000003-0000-0ff1-ce00-000000000000' does not exist or one of its queried reference-property objects are not present.”
In my command, $spoappid is '00000003-0000-0ff1-ce00-000000000000', while $params is
$params = @{
keyCredential = @{
type = "AsymmetricX509Cert"
usage = "Verify"
key = [System.Text.Encoding]::ASCII.GetBytes("MIIDYDCCAki...")
}
passwordCredential = $null
proof = "eyJ0eXAiOiJ..."
}
According to this part in our document Configure server-to-server authentication from SharePoint Server to SharePoint in Microsoft 365,
I wonder where I can find the source code of Add-MgServicePrincipalKey
so that I can troubleshoot my error by myself?
Expected behavior
This PS cmdlet can work without any errors.
How to reproduce
$spoappid="00000003-0000-0ff1-ce00-000000000000"
Import-Module Microsoft.Graph.Applications
$params = @{
keyCredential = @{
type = "AsymmetricX509Cert"
usage = "Verify"
key = [System.Text.Encoding]::ASCII.GetBytes("MIIDYDCCAki...")
}
passwordCredential = $null
proof = "eyJ0eXAiOiJ..."
}
Add-MgServicePrincipalKey -ServicePrincipalId $spoappid -BodyParameter $params
SDK Version
2.19.0
Latest version known to work for scenario above?
No response
Known Workarounds
No response
Debug output
Click to expand log
```</details>
### Configuration
_No response_
### Other information
_No response_