Skip to content

Test-MgServicePrincipalSynchronizationJobCredential do not return bool value #2977

@MasterKuat

Description

@MasterKuat

Describe the bug

I'm testing new credential validatity for ServicePrincipal sync job (Enterprise app / SCIM job).
Per documentation this cmdlet must return boolean.

But if credential is correct, the cmdlet return nothing.

API return a status 204, No Content as expected.
Surely the root cause.

If credential is wrong, cmdlet report an error.

Expected behavior

Return $True or $False without Error

How to reproduce

$params = @{
credentials = @(
@{
"key" = "BaseAddress"
"value" = "mytenantURL"
},
@{
"key" = "SecretToken"
"value" = "MySecretToken"
}
)
}

Test-MgServicePrincipalSynchronizationJobCredential -ServicePrincipalId $EnterpriseApp.Id -SynchronizationJobId $Syncjob.Id -BodyParameter $params

SDK Version

2.23.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

Click to expand log ```

DEBUG: [CmdletBeginProcessing]: - Test-MgServicePrincipalSynchronizationJobCredential begin processing with parameterSet 'Validate'.
DEBUG: [Authentication]: - AuthType: 'ManagedIdentity', TokenCredentialType: 'ManagedIdentity', ContextScope: 'Process', AppName: 'MyIdentity'.
DEBUG: [Authentication]: - Scopes: [Application.ReadWrite.OwnedBy].
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
POST

Absolute Uri:
https://graph.microsoft.com/v1.0/servicePrincipals/spnID/synchronization/jobs/synJobID/microsoft.graph.validateCredentials

Headers:
FeatureFlag : 00000043
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.19045; fr-FR),PowerShell/5.1.19041.4894
Accept-Encoding : gzip
SdkVersion : graph-powershell/2.23.0
client-request-id : 10664500-1ad6-412f-83ef-e182f355edbb

Body:
{
"credentials": [
{
"key": "BaseAddress",
"value": "mytenantURL"
},
{
"key": "SecretToken",
"value": "MySecretToken"
}
]
}

DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
NoContent

Headers:
Strict-Transport-Security : max-age=31536000
request-id : 347f6935-9739-42c1-be16-64b9f897e521
client-request-id : 10664500-1ad6-412f-83ef-e182f355edbb
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"West Europe","Slice":"E","Ring":"5","ScaleUnit":"010","RoleInstance":"AM4PEPF000355B9"}}
Date : Mon, 30 Sep 2024 12:34:27 GMT

Body:

DEBUG: [CmdletEndProcessing]: - Test-MgServicePrincipalSynchronizationJobCredential end processing.

</details>


### Configuration

Name                           Value                                                                                                                                                                                                                                              
----                           -----                                                                                                                                                                                                                                              
PSVersion                      5.1.19041.4894                                                                                                                                                                                                                                     
PSEdition                      Desktop                                                                                                                                                                                                                                            
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                                                                                                            
BuildVersion                   10.0.19041.4894                                                                                                                                                                                                                                    
CLRVersion                     4.0.30319.42000                                                                                                                                                                                                                                    
WSManStackVersion              3.0                                                                                                                                                                                                                                                
PSRemotingProtocolVersion      2.3                                                                                                                                                                                                                                                
SerializationVersion           1.1.0.1
OS : Win10
Architecture: x64


### Other information

_No response_

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions