web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Unable to Associate M...
Power Automate
Answered

Unable to Associate Managed Metadata Column with Term Set

(1) ShareShare
ReportReport
Posted on by 2

Hi everyone,

I'm currently working on automating the creation of a Managed Metadata column in a SharePoint Online library using Power Automate. I’ve successfully used the "Send an HTTP request to SharePoint" action to:

  • Add a TaxonomyFieldType column to a library using the CreateFieldAsXml endpoint.
  • Retrieve the field’s GUID using the /fields/getbyinternalnameortitle() endpoint.
  • Get a valid FormDigestValue using the _api/contextinfo endpoint for secure updates.

I can successfully create the metadata field with the following schema:

{
  "parameters": {
    "__metadata": {
      "type": "SP.XmlSchemaFieldCreationInformation"
    },
    "SchemaXml": "<Field Type='TaxonomyFieldType' DisplayName='Cool Metadata' StaticName='CoolMetadata' Name='CoolMetadata' ShowField='Term1033' Required='FALSE' EnforceUniqueValues='FALSE' Group='Test' />"
  }
}
 
I also successfully retrieve the field GUID via: _api/web/lists/getbytitle('Test')/fields/getbyinternalnameortitle('CoolMetadata') And get the FormDigestValue with _api/contextinfo.
 

When I attempt to associate the field with an existing Term Set via the /update endpoint, I get a 502 Bad Gateway error.

Here’s the full URI I’m calling (dynamically composed):

_api/web/lists/getbytitle('Test')/fields('<FieldGUID>')/update

Headers:

{
  "Accept": "application/json;odata=verbose",
  "Content-Type": "application/json;odata=verbose",
  "X-RequestDigest": "<dynamic from contextinfo step>"
}

Body:

{
  "__metadata": { "type": "SP.Taxonomy.TaxonomyField" },
  "SspId": "2954755e-a0f9-4a35-a115-f7b718803e78",
  "TermSetId": "9dc7c5f5-21f1-41fe-b213-bd1438d78c43",
  "AnchorId": "00000000-0000-0000-0000-000000000000",
  "AllowMultipleValues": false,
  "Open": false
}

Error Message:

BadGateway
The parameter __metadata does not exist in method GetById.
clientRequestId: <GUID>
serviceRequestId: <GUID>

I’ve validated that:

  • The field is successfully created as a taxonomy field
  • The X-RequestDigest is being passed dynamically and is valid
  • The /update endpoint is correct syntactically (per SharePoint REST documentation)
  • Changing "__metadata": { "type": "SP.Taxonomy.TaxonomyField" } to "SP.Field" also results in the same error

Any insight would be appreciated. I’m trying to keep this within a native Power Automate context if possible, but open to options.

Thanks in advance!

—Chris

Categories:
I have the same question (0)
  • Verified answer
    SwatiSTW Profile Picture
    809 Super User 2026 Season 1 on at
    Creating the taxonomy field using REST works fine. You can use the CreateFieldAsXml endpoint to add a TaxonomyFieldType field. It auto-creates the hidden note field too. Use X-RequestDigest only when needed for updates.
     
    The issue is with associating the field to a term set. REST API doesn't support setting TermSetId, SspId, or AnchorId for taxonomy fields. That’s why your /update call returns a 502 error. These properties require CSOM or PnP.PowerShell.
     
    To make it work, use an Azure Function or Azure Automation Runbook to run PnP PowerShell or C# CSOM. Power Automate will trigger this via HTTP action. Note: HTTP action needs Premium license. Avoid using /ProcessQuery — it’s unsupported and unstable in flows.
     
    Here’s a working PnP PowerShell snippet:
    Connect-PnPOnline -Url "https://tenant.sharepoint.com/sites/yoursite" -Interactive
    $field = Get-PnPField -List "Test" -Identity "CoolMetadata"
    Set-PnPTaxonomyField -Field $field -TermSetId "9dc7c5f5-21f1-41fe-b213-bd1438d78c43" -TermStoreId "2954755e-a0f9-4a35-a115-f7b718803e78"
     
    So use REST to create the field, but CSOM (via Azure Function or Runbook) to link it to a term set. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 382

#2
Valantis Profile Picture

Valantis 370

#3
David_MA Profile Picture

David_MA 300 Super User 2026 Season 1

Last 30 days Overall leaderboard