-
Notifications
You must be signed in to change notification settings - Fork 216
Description
Describe the bug
A clear and concise description of what the bug is.
Update-MgBetaServicePrincipalSynchronizationJobSchema fails when attempting to update cross-tenant sync attribute-mapping, likely because OpenAPI specifies PATCH but documentation for the API specifies PUT
NB; See #1134 that was closed just over 2 years ago without resolution
To Reproduce
Steps to reproduce the behavior:
- $syncJob = Get-MgServicePrincipalSynchronizationJob -ServicePrincipalId $ServicePrincipalId
- $JobId = $syncJob.Id
- $SynchronizationSchema = Get-MgServicePrincipalSynchronizationJobSchema -ServicePrincipalId $ServicePrincipalId -SynchronizationJobId $JobId
- $newSyncRules = $SynchronizationSchema.SynchronizationRules
- (update attribute-mapping for User to User)
- $newSyncRules.ObjectMappings[$n].AttributeMappings = $attributeMappings
- Update-MgBetaServicePrincipalSynchronizationJobSchema -ServicePrincipalId $ServicePrincipalId -SynchronizationJobId $JobId -Directories $SynchronizationSchema.Directories -Id $SynchronizationSchema.Id -SynchronizationRules $newSyncRules -Version $SynchronizationSchema.Version -Debug
Expected behavior
A clear and concise description of what you expected to happen.
The schema should be updated with the modified attribute-mappings
Debug Output
(shortened)
Describe the bug
A clear and concise description of what the bug is.
Update-MgBetaServicePrincipalSynchronizationJobSchema fails when attempting to update cross-tenant sync attribute-mapping, likely because OpenAPI specifies PATCH but documentation for the API specifies PUT
To Reproduce
Steps to reproduce the behavior:
- $syncJob = Get-MgServicePrincipalSynchronizationJob -ServicePrincipalId $ServicePrincipalId
- $JobId = $syncJob.Id
- $SynchronizationSchema = Get-MgServicePrincipalSynchronizationJobSchema -ServicePrincipalId $ServicePrincipalId -SynchronizationJobId $JobId
- $newSyncRules = $SynchronizationSchema.SynchronizationRules
- (update attribute-mapping for User to User)
- $newSyncRules.ObjectMappings[$n].AttributeMappings = $attributeMappings
- Update-MgBetaServicePrincipalSynchronizationJobSchema -ServicePrincipalId $ServicePrincipalId -SynchronizationJobId $JobId -Directories $SynchronizationSchema.Directories -Id $SynchronizationSchema.Id -SynchronizationRules $newSyncRules -Version $SynchronizationSchema.Version -Debug
Expected behavior
A clear and concise description of what you expected to happen.
The schema should be updated with the modified attribute-mappings
Debug Output
(shortened)
PS> Update-MgBetaServicePrincipalSynchronizationJobSchema -ServicePrincipalId $ServicePrincipalId -SynchronizationJobId $JobId -Directories $SynchronizationSchema.Directories -Id $SynchronizationSchema.Id -SynchronizationRules $newSyncRules -Version $SynchronizationSchema.Version -Debug
DEBUG: [CmdletBeginProcessing]: - Update-MgBetaServicePrincipalSynchronizationJobSchema begin processing with parameterSet 'UpdateExpanded'.
DEBUG: [Authentication]: - AuthType: 'Delegated', TokenCredentialType: 'InteractiveBrowser', ContextScope: 'CurrentUser', AppName: 'Microsoft Graph Command Line Tools'.
DEBUG: [Authentication]: - Scopes: [Application.ReadWrite.All, AuditLog.Read.All, Directory.Read.All, Directory.ReadWrite.All, Group.Read.All, openid, Policy.Read.All, Policy.ReadWrite.CrossTenantAccess, profile, email, Synchronization.ReadWrite.All].
Performing the operation "Update-MgBetaServicePrincipalSynchronizationJobSchema_UpdateExpanded" on target "Call remote 'PATCH /servicePrincipals/{servicePrincipal-id}/synchronization/jobs/{synchronizationJob-id}/schema' operation".
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
PATCH
Headers:
FeatureFlag : 00000043
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.17763; da-DK),PowerShell/5.1.17763.5576
Accept-Encoding : gzip
SdkVersion : graph-powershell-beta/2.15.0
client-request-id : 0d5abf56-b198-42c7-bf49-ece62bfaac00
Body:
{
"id": "Azure2Azure.17782bb83ab94615a992df7fa486dbc7.700ae644-ca21-49d6-938b-92c5dd0ed715",
"synchronizationRules": [
{
"editable": true,
"id": "01e28086-1453-4cb2-b95d-4fbc4564fcc0",
"metadata": [
{
"key": "defaultSourceObjectMappings",
(...)
"value": "[{"AttributeMappings": },
{
"key": "supportsProvisionOnDemand",
"value": "true"
}
],
"name": "USER_INBOUND_USER",
"objectMappings": [
{
"attributeMappings": [
{
"defaultValue": "False",
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 0,
"targetAttributeName": "IsSoftDeleted",
"source": {
"expression": "[IsSoftDeleted]",
"name": "IsSoftDeleted",
"type": "Attribute"
}
},
{
"defaultValue": "True",
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 0,
"targetAttributeName": "accountEnabled",
"source": {
"expression": "[accountEnabled]",
"name": "accountEnabled",
"type": "Attribute"
}
},
{
"defaultValue": "",
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 0,
"targetAttributeName": "streetAddress",
"source": {
"expression": "[streetAddress]",
"name": "streetAddress",
"type": "Attribute"
}
},
{
"defaultValue": "",
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 0,
"targetAttributeName": "city",
"source": {
"expression": "[city]",
"name": "city",
"type": "Attribute"
}
},
{
"defaultValue": "",
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 0,
"targetAttributeName": "state",
"source": {
"expression": "[state]",
"name": "state",
"type": "Attribute"
}
},
{
"defaultValue": "",
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 0,
"targetAttributeName": "postalCode",
"source": {
"expression": "[postalCode]",
"name": "postalCode",
"type": "Attribute"
}
},
{
"defaultValue": "",
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 0,
"targetAttributeName": "country",
"source": {
"expression": "[country]",
"name": "country",
"type": "Attribute"
}
},
{
"defaultValue": "",
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 0,
"targetAttributeName": "companyName",
"source": {
"expression": "[companyName]",
"name": "companyName",
"type": "Attribute"
}
},
{
"defaultValue": "",
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 0,
"targetAttributeName": "department",
"source": {
"expression": "[department]",
"name": "department",
"type": "Attribute"
}
},
{
"defaultValue": "",
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 0,
"targetAttributeName": "employeeId",
"source": {
"expression": "[employeeId]",
"name": "employeeId",
"type": "Attribute"
}
},
{
"defaultValue": "",
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 0,
"targetAttributeName": "displayName",
"source": {
"expression": "[displayName]",
"name": "displayName",
"type": "Attribute"
}
},
{
"defaultValue": "",
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 0,
"targetAttributeName": "extensionAttribute1",
"source": {
"expression": ""CrossTenantSynced"",
"name": "CrossTenantSynced",
"type": "Constant"
}
},
{
"defaultValue": "",
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 0,
"targetAttributeName": "extensionAttribute2",
"source": {
"expression": ""CU3711"",
"name": "CU3711",
"type": "Constant"
}
},
{
"defaultValue": "",
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 0,
"targetAttributeName": "givenName",
"source": {
"expression": "[givenName]",
"name": "givenName",
"type": "Attribute"
}
},
{
"defaultValue": "",
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 0,
"targetAttributeName": "jobTitle",
"source": {
"expression": "[jobTitle]",
"name": "jobTitle",
"type": "Attribute"
}
},
{
"defaultValue": "",
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 0,
"targetAttributeName": "mailNickname",
"source": {
"expression": "[mailNickname]",
"name": "mailNickname",
"type": "Attribute"
}
},
{
"defaultValue": "",
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 0,
"targetAttributeName": "manager",
"source": {
"expression": "[manager]",
"name": "manager",
"type": "Attribute"
}
},
{
"defaultValue": "",
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 0,
"targetAttributeName": "physicalDeliveryOfficeName",
"source": {
"expression": "[physicalDeliveryOfficeName]",
"name": "physicalDeliveryOfficeName",
"type": "Attribute"
}
},
{
"defaultValue": "da-DK",
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 0,
"targetAttributeName": "preferredLanguage",
"source": {
"expression": "[preferredLanguage]",
"name": "preferredLanguage",
"type": "Attribute"
}
},
{
"defaultValue": "",
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 0,
"targetAttributeName": "surname",
"source": {
"expression": "[surname]",
"name": "surname",
"type": "Attribute"
}
},
{
"defaultValue": "",
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 0,
"targetAttributeName": "telephoneNumber",
"source": {
"expression": "[telephoneNumber]",
"name": "telephoneNumber",
"type": "Attribute"
}
},
{
"defaultValue": "",
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 0,
"targetAttributeName": "usageLocation",
"source": {
"expression": "[usageLocation]",
"name": "usageLocation",
"type": "Attribute"
}
},
{
"defaultValue": "",
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 0,
"targetAttributeName": "userPrincipalName",
"source": {
"expression": "[userPrincipalName]",
"name": "userPrincipalName",
"type": "Attribute"
}
},
{
"defaultValue": "",
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "ObjectAddOnly",
"matchingPriority": 1,
"targetAttributeName": "alternativeSecurityIds",
"source": {
"expression": "[alternativeSecurityIds]",
"name": "alternativeSecurityIds",
"type": "Attribute"
}
},
{
"defaultValue": "",
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 0,
"targetAttributeName": "showInAddressList",
"source": {
"expression": "[showInAddressList]",
"name": "showInAddressList",
"type": "Attribute"
}
},
{
"defaultValue": "",
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 0,
"targetAttributeName": "mail",
"source": {
"expression": "[mail]",
"name": "mail",
"type": "Attribute"
}
},
{
"defaultValue": "",
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 0,
"targetAttributeName": "userType",
"source": {
"expression": "[userType]",
"name": "userType",
"type": "Attribute"
}
}
],
"enabled": true,
"flowTypes": "Add,Update,Delete",
"metadata": [
(...)
],
"name": "Provision Microsoft Entra ID Users",
"sourceObjectName": "User",
"targetObjectName": "User",
"scope": {
"categoryFilterGroups": [],
"groups": [],
"inputFilterGroups": [
{
(...)
"name": "Filter external users"
}
]
}
},
{
"attributeMappings": [
{
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 1,
"targetAttributeName": "objectId"
}
],
"enabled": false,
(...)
},
{
"attributeMappings": [
{
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 1,
"targetAttributeName": "appId"
}
],
"enabled": false,
(...)
},
{
"attributeMappings": [
(...)
],
"enabled": false,
(...)
},
{
"attributeMappings": [
{
"exportMissingReferences": false,
"flowBehavior": "FlowWhenChanged",
"flowType": "Always",
"matchingPriority": 1,
"targetAttributeName": "id"
}
],
"enabled": false,
(...)
},
{
"attributeMappings": [
(...)
],
"enabled": false,
(...) }
],
"priority": 1,
"sourceDirectoryName": "Microsoft Entra ID",
"targetDirectoryName": "Azure Active Directory (target tenant)"
}
],
"version": "Date:2024-03-11T11:07:48.7217138Z, ActivityId:22545759-9095-4a2a-96ec-ff63485ca7d8",
"directories": [
{
"id": "66e4a8cc-1b7b-435e-95f8-f06cea133828",
"discoverabilities": "AttributeNames,AttributeDataTypes",
"name": "Microsoft Entra ID",
"objects": [
{
"attributes": [
(...)
],
"metadata": [
(...)
],
"name": "User",
"supportedApis": [
"User"
]
},
{
"attributes": [
(...) ],
"metadata": [
(...) ],
"name": "Group",
"supportedApis": [
"Group"
]
},
{
"attributes": [
(...) ],
"metadata": [
(...) ],
"name": "Application",
"supportedApis": [
"Application"
]
},
{
"attributes": [
(...) ],
"metadata": [
(...) ],
"name": "AppRole",
"supportedApis": [
"AppRole"
]
},
{
"attributes": [
(...) ],
"metadata": [
(...) ],
"name": "AppRoleAssignment",
"supportedApis": [
"AppRoleAssignment"
]
},
{
"attributes": [
(...) ],
"metadata": [
(...) ],
"name": "ServicePrincipal",
"supportedApis": [
"ServicePrincipal"
]
}
],
"readOnly": true,
"version": "Date:2024-03-11T11:07:48.7217138Z, ActivityId:22545759-9095-4a2a-96ec-ff63485ca7d8"
},
{
"id": "69b25323-f16d-4d8f-99e9-2722c9582d30",
"discoverabilities": "AttributeNames,AttributeDataTypes",
"name": "Azure Active Directory (target tenant)",
"objects": [
{
"attributes": [
(...) ],
"metadata": [
(...) ],
"name": "User",
"supportedApis": [
"User"
]
},
{
"attributes": [
(...) ],
"metadata": [
(...) ],
"name": "Group",
"supportedApis": [
"Group"
]
},
{
"attributes": [
(...) ],
"metadata": [
(...) ],
"name": "Application",
"supportedApis": [
"Application"
]
},
{
"attributes": [
(...) ],
"metadata": [
(...) ],
"name": "AppRole",
"supportedApis": [
"AppRole"
]
},
{
"attributes": [
(...) ],
"metadata": [
(...) ],
"name": "AppRoleAssignment",
"supportedApis": [
"AppRoleAssignment"
]
},
{
"attributes": [
(...) ],
"metadata": [
(...) ],
"name": "ServicePrincipal",
"supportedApis": [
"ServicePrincipal"
]
}
],
"readOnly": true,
"version": "Date:2024-03-11T11:07:48.7217138Z, ActivityId:22545759-9095-4a2a-96ec-ff63485ca7d8"
}
]
}
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
NotFound
Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : 19c60366-244d-4c6e-9411-a146a29565cb
client-request-id : 0d5abf56-b198-42c7-bf49-ece62bfaac00
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Norway East","Slice":"E","Ring":"5","ScaleUnit":"001","RoleInstance":"OSL2EPF00000168"}}
Date : Fri, 22 Mar 2024 14:10:06 GMT
Body:
{
"error": {
"code": "UnknownError",
"message": "{"Message":"No HTTP resource was found that matches the request URI 'https://syncfabric.windowsazure.com/api/servicePrincipals('804c4acb-c652-4f81-81aa-1d647c270326')/synchronization/jobs('Azure2Azure.17782bb83ab94615a992df7fa486dbc7.700ae644-ca21-49d6-938b-92c5dd0ed715')/schema?api-version=2.0'.\"}",
"innerError": {
"date": "2024-03-22T14:10:06",
"request-id": "19c60366-244d-4c6e-9411-a146a29565cb",
"client-request-id": "0d5abf56-b198-42c7-bf49-ece62bfaac00"
}
}
}
Confirm
{"Message":"No HTTP resource was found that matches the request URI 'https://syncfabric.windowsazure.com/api/servicePrincipals('804c4acb-c652-4f81-81aa-1d647c270326')/synchronization/jobs('Azure2Azure.17782bb83ab94615a992df7fa486dbc7.700ae644-ca21-49d6-938b-92c5dd0ed715')/schema?api-version=2.0'."}
Status: 404 (NotFound)
ErrorCode: UnknownError
Date: 2024-03-22T14:10:06
Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : 19c60366-244d-4c6e-9411-a146a29565cb
client-request-id : 0d5abf56-b198-42c7-bf49-ece62bfaac00
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Norway East","Slice":"E","Ring":"5","ScaleUnit":"001","RoleInstance":"OSL2EPF00000168"}}
Date : Fri, 22 Mar 2024 14:10:06 GMT
Update-MgBetaServicePrincipalSynchronizationJobSchema : {"Message":"No HTTP resource was found that matches the request
URI 'https://syncfabric.windowsazure.com/api/servicePrincipals('804c4acb-c652-4f81-81aa-1d647c270326')/synchronization/j
obs('Azure2Azure.17782bb83ab94615a992df7fa486dbc7.700ae644-ca21-49d6-938b-92c5dd0ed715')/schema?api-version=2.0'."}
Status: 404 (NotFound)
ErrorCode: UnknownError
Date: 2024-03-22T14:10:06
Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : 19c60366-244d-4c6e-9411-a146a29565cb
client-request-id : 0d5abf56-b198-42c7-bf49-ece62bfaac00
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Norway East","Slice":"E","Ring":"5","ScaleUnit":"001","Role
Instance":"OSL2EPF00000168"}}
Date : Fri, 22 Mar 2024 14:10:06 GMT
At line:1 char:1
- Update-MgBetaServicePrincipalSynchronizationJobSchema -ServicePrincip ...
-
+ CategoryInfo : InvalidOperation: ({ ServicePrinci...izationSchema }:<>f__AnonymousType115`4) [Update-MgBe
taSe..._UpdateExpanded], Exception
+ FullyQualifiedErrorId : UnknownError,Microsoft.Graph.Beta.PowerShell.Cmdlets.UpdateMgBetaServicePrincipalSynchroni
zationJobSchema_UpdateExpanded
ParameterBinding(Out-Default): name="InputObject"; value="{"Message":"No HTTP resource was found that matches the request URI 'https://syncfabric.windowsazure.com/api/servicePrincipals('804c4acb-c652-4f81-81aa-1d647c270326')/synchronization/jobs('Azure2Azure.17782bb83ab94615a992df7fa486dbc7.700ae644-ca21-49d6-938b-92c5dd0ed715')/schema?api-version=2.0'."}
Status: 404 (NotFound)
ErrorCode: UnknownError
Date: 2024-03-22T14:10:06
Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : 19c60366-244d-4c6e-9411-a146a29565cb
client-request-id : 0d5abf56-b198-42c7-bf49-ece62bfaac00
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Norway East","Slice":"E","Ring":"5","ScaleUnit":"001","RoleInstance":"OSL2EPF00000168"}}
Date : Fri, 22 Mar 2024 14:10:06 GMT
"
Update-MgBetaServicePrincipalSynchronizationJobSchema : {"Message":"No HTTP resource was found that matches the request URI 'https://syncfabric.windowsazure.com/api/servicePrincipals('804c4
acb-c652-4f81-81aa-1d647c270326')/synchronization/jobs('Azure2Azure.17782bb83ab94615a992df7fa486dbc7.700ae644-ca21-49d6-938b-92c5dd0ed715')/schema?api-version=2.0'."}
Status: 404 (NotFound)
ErrorCode: UnknownError
Date: 2024-03-22T14:10:06
Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : 19c60366-244d-4c6e-9411-a146a29565cb
client-request-id : 0d5abf56-b198-42c7-bf49-ece62bfaac00
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Norway East","Slice":"E","Ring":"5","ScaleUnit":"001","RoleInstance":"OSL2EPF00000168"}}
Date : Fri, 22 Mar 2024 14:10:06 GMT
At line:1 char:1
- Update-MgBetaServicePrincipalSynchronizationJobSchema -ServicePrincip ...
-
+ CategoryInfo : InvalidOperation: ({ ServicePrinci...izationSchema }:<>f__AnonymousType115`4) [Update-MgBetaSe..._UpdateExpanded], Exception + FullyQualifiedErrorId : UnknownError,Microsoft.Graph.Beta.PowerShell.Cmdlets.UpdateMgBetaServicePrincipalSynchronizationJobSchema_UpdateExpanded
DEBUG: [CmdletEndProcessing]: - Update-MgBetaServicePrincipalSynchronizationJobSchema end processing.
Module Version
2.15.0
Environment Data
Windows Popwershell 5.1
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.