| title | Create corsConfiguration_v2 |
|---|---|
| description | Create a new corsConfiguration_v2 object. |
| author | dhruvinrshah |
| ms.localizationpriority | medium |
| ms.subservice | entra-applications |
| doc_type | apiPageType |
| ms.date | 12/19/2024 |
Namespace: microsoft.graph
[!INCLUDE beta-disclaimer]
Create a new corsConfiguration_v2 object.
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
[!INCLUDE permissions-table]
[!INCLUDE rbac-app-proxy-write]
POST /applications/{applicationObjectId}/onPremisesPublishing/segmentsConfiguration/microsoft.graph.webSegmentConfiguration/applicationSegments/{webApplicationSegment-id}/corsConfigurations| Name | Description |
|---|---|
| Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
| Content-Type | application/json. Required. |
In the request body, supply a JSON representation of the corsConfiguration_v2 object.
You can specify the following properties when creating a corsConfiguration_v2.
| Property | Type | Description |
|---|---|---|
| resource | String | Resource within the application segment for which CORS permissions are granted. / grants permission for the whole app segment. Required. |
| allowedOrigins | String collection | The origin domains that are permitted to make a request against the service via CORS. The origin domain is the domain from which the request originates. The origin must be an exact case-sensitive match with the origin that the user agent sends to the service. Optional. |
| allowedHeaders | String collection | The request headers that the origin domain may specify on the CORS request. The wildcard character * indicates that any header beginning with the specified prefix is allowed. Optional. |
| allowedMethods | String collection | The HTTP request methods that the origin domain may use for a CORS request. Optional. |
| maxAgeInSeconds | Int32 | The maximum amount of time that a browser should cache the response to the preflight OPTIONS request. Optional. |
If successful, this method returns a 201 Created response code and a corsConfiguration_v2 object in the response body.
The following example shows a request.
POST https://graph.microsoft.com/beta/applications/129d6e80-484f-4d1f-bfca-a6a859d138ac/onPremisesPublishing/segmentsConfiguration/microsoft.graph.webSegmentConfiguration/ApplicationSegments/209efffb-0777-42b0-a65c-4e3ddb1ab3c0/corsConfigurations
Content-Type: application/json
{
"allowedOrigins":[""],
"allowedHeaders":[""],
"allowedMethods":["*"],
"maxAgeInSeconds":3000,
"resource":"/"
}[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Content-Type: application/json
{
"allowedOrigins":[""],
"allowedHeaders":[""],
"allowedMethods":["*"],
"maxAgeInSeconds":3000,
"resource":"/"
}