Muokkaa

Jaa


Create corsConfiguration_v2

Namespace: microsoft.graph

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.

Create a new corsConfiguration_v2 object.

Permissions

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.

Permission type Least privileged permission Higher privileged permissions
Delegated (work or school account) Not supported. Not supported.
Delegated (personal Microsoft account) Not supported. Not supported.
Application Not supported. Not supported.

Important

In delegated scenarios with work or school accounts, the signed-in user must be assigned a supported Microsoft Entra role or a custom role with a supported role permission. Application Administrator is the least privileged role supported for this operation. Cloud Application Administrator can't manage app proxy settings.

HTTP request

POST /applications/{applicationObjectId}/onPremisesPublishing/segmentsConfiguration/microsoft.graph.webSegmentConfiguration/applicationSegments/{webApplicationSegment-id}/corsConfigurations

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-Type application/json. Required.

Request body

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.

Response

If successful, this method returns a 201 Created response code and a corsConfiguration_v2 object in the response body.

Examples

Request

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":"/"
}

Response

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":"/"
}