Forum Discussion

jvdlinden-cert's avatar
jvdlinden-cert
Copper Contributor
Oct 09, 2025

Create new site through App Reg auth and associate it with a hub site

Hi all,

I have created a Logic App in Azure and I am using this Logic App to create new team sites (no Microsoft 365 group) in SharePoint Online. 

For the authentication I have created an app registration (Sites.FullControl.All) and created a self-signed certificate for the authentication.
For the audience I am using the https://tenantname-admin.sharepoint.com

I am using the following request URL:

https://tenantname-admin.sharepoint.com/_api/SPSiteManager/create

 

I am using the following request headers:

Accept = application/json;odata.metadata=none

odata-version = 4.0

 

I use the following request body:

{
  "request": {
    "Title": "Site name",
    "Url": "<project number variable>",
    "Lcid": 1043,
    "Description": "Just some text",
    "WebTemplate": "STS#3",
    "Owner": "email address removed for privacy reasons",
    "SensitivityLabel": "Sensitivity label GUID",
    "HubSiteId": "Hub site ID"
  }
}

Somehow, I get an unauthorized error. When I omit the HubSiteId parameter, it works fine.

In the SharePoint admin center I have not configured users that are authorized to associate sites with the hub sites. I also tried to assign the app registration through PowerShell, but it doesn't work.

 

My question is, how can I authorize the app registration to associate the site with the hub site specified upon creating the new site?

 

Thanks for all help provided!

 

No RepliesBe the first to reply

Resources