microsoftgraph / microsoftgraph/msgraph-sdk-powershell

New-MgExternalConnectionItem returns 404 errors

Open
#3,375 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Status: Needs Investigation type:bug
Dominant language
C#
Stars
898
Forks
230
Avg merge
2d 5h
Merged PRs (30d)
31

Description

Describe the bug

I am trying to create new external connection items for an external connector, and I get a 404 not-found error message in response.
Here is the command I use-
$newItem = New-MgExternalConnectionItem -ExternalConnectionId "samplecon" -id $id -Properties $props -Content $content -Acl $acl

A fiddler trace of the above call shows this-
POST https://graph.microsoft.com/v1.0/external/connections/samplecon/items

The body is this-
{
"id": "R06",
"acl": [
{
"accessType": "grant",
"type": "everyoneExceptGuests",
"value": "56713e33-e7c4-4ce4-ac45-a4ae33ab87b7"
}
],
"properties": {
"title": "Adding Test Items",
"language": "hu-HU",
"floor": [
"London_B1"
],
"floor@odata.type": "Collection(String)",
"recordId": "R06"
},
"content": {
"type": "text",
"value": "A new item R06"
}
}

Expected behavior

I expect the new-item to be created and stored in the $newItem variable.

How to reproduce
  1. connect with MGGraph-
    Connect-MgGraph -ClientId "{client_id}" -TenantId "{tenant}.onmicrosoft.com" -certificate $x509Cert

#Make sure the app has ExternalConnection.ReadWrite.OwnedBy | ExternalConnection.ReadWrite.All and ExternalItem.ReadWrite.OwnedBy | ExternalItem.ReadWrite.All

  1. create the external connection
    $newConnector = New-MgExternalConnection -BodyParameter $connector

  2. add the schema for the external connection
    $schemaUpdateResp = Update-MgExternalConnectionSchema -ExternalConnectionId $newConnector.Id -BodyParameter $schema

  3. add an external connection item to the connection
    $newItem = New-MgExternalConnectionItem -ExternalConnectionId "samplecon" -id $id -Properties $props -Content $content -Acl $acl

SDK Version

2.27.0 Microsoft.Graph.Search

Latest version known to work for scenario above?

?

Known Workarounds

The $id, $acl, and $props are all good because if I use fiddler to resend the request, but modify it to use the verb PUT and add the ID to the URL, it works. This is how the Graph REST API has in the documentation-
https://learn.microsoft.com/en-us/graph/connecting-external-content-manage-items#add-an-item

Debug output
Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the New-MgExternalConnectionItem entry point and compare the request it generates with the Microsoft Graph add-an-item documentation linked in the issue. Reproduce the POST request and verify that the cmdlet uses the documented item URL and method, then confirm the command stores the created item successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.