名前空間: microsoft.graph
重要
Microsoft Graph の /beta バージョンの API は変更される可能性があります。 実稼働アプリケーションでこれらの API を使用することは、サポートされていません。 v1.0 で API を使用できるかどうかを確認するには、Version セレクターを使用します。
新しい operationalInsightsConnection オブジェクトを 作成します。
この API は、次の国内クラウド展開で使用できます。
| グローバル サービス |
米国政府機関 L4 |
米国政府機関 L5 (DOD) |
21Vianet が運営する中国 |
| ✅ |
✅ |
✅ |
❌ |
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。
アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。
| アクセス許可の種類 |
最小特権アクセス許可 |
より高い特権のアクセス許可 |
| 委任 (職場または学校のアカウント) |
WindowsUpdates.ReadWrite.All |
注意事項なし。 |
| 委任 (個人用 Microsoft アカウント) |
サポートされていません。 |
サポートされていません。 |
| アプリケーション |
WindowsUpdates.ReadWrite.All |
注意事項なし。 |
重要
職場または学校アカウントを使用した委任されたシナリオでは、サインインしているユーザーは、グループの所有者またはメンバーであるか、サポートされているMicrosoft Entraロールまたはサポートされているロールのアクセス許可を持つカスタム ロールが割り当てられている必要があります。
Intune管理者、またはWindows Update展開管理者は、この操作でサポートされる最小限の特権ロールです。
HTTP 要求
POST /admin/windows/updates/resourceConnections
| 名前 |
説明 |
| Authorization |
ベアラー {token}。 必須です。
認証と認可についての詳細をご覧ください。 |
| Content-Type |
application/json. 必須です。 |
要求本文
要求本文で、 operationalInsightsConnection オブジェクトの JSON 表現を指定します。
operationalInsightsConnection を作成するときは、次のプロパティを指定する必要があります。
| プロパティ |
型 |
説明 |
| azureResourceGroupName |
文字列 |
Log Analytics ワークスペースを含む Azure リソース グループの名前。 |
| azureSubscriptionId |
String |
Log Analytics ワークスペースを含む Azure サブスクリプション ID。 |
| workspaceName |
文字列 |
Log Analytics ワークスペースの名前。 |
応答
成功した場合、このメソッドは応答コード 201 Created と、応答本文に operationalInsightsConnection オブジェクトを返します。
次のエラーが発生する可能性があります。
| 応答コード |
メッセージ |
400 Bad Request |
指定したワークスペースをリンクできませんでした。 キー プロパティが正しいことを確認します。 |
403 Forbidden |
指定したワークスペースをリンクできませんでした。 Azure サブスクリプションがアクティブであることを確認します。 |
409 Conflict |
指定されたリソースは既に存在します。 |
例
要求
次の例は要求を示しています。
POST https://graph.microsoft.com/beta/admin/windows/updates/resourceConnections
Content-Type: application/json
Content-length: 97
{
"@odata.type": "#microsoft.graph.windowsUpdates.operationalInsightsConnection",
"azureSubscriptionId": "322ec614-e9c2-4cd5-a55c-5711fdecf02e",
"azureResourceGroupName": "target-resource-group",
"workspaceName": "my-workspace"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models.WindowsUpdates;
var requestBody = new OperationalInsightsConnection
{
OdataType = "#microsoft.graph.windowsUpdates.operationalInsightsConnection",
AzureSubscriptionId = "322ec614-e9c2-4cd5-a55c-5711fdecf02e",
AzureResourceGroupName = "target-resource-group",
WorkspaceName = "my-workspace",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Admin.Windows.Updates.ResourceConnections.PostAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodelswindowsupdates "github.com/microsoftgraph/msgraph-beta-sdk-go/models/windowsupdates"
//other-imports
)
requestBody := graphmodelswindowsupdates.NewResourceConnection()
azureSubscriptionId := "322ec614-e9c2-4cd5-a55c-5711fdecf02e"
requestBody.SetAzureSubscriptionId(&azureSubscriptionId)
azureResourceGroupName := "target-resource-group"
requestBody.SetAzureResourceGroupName(&azureResourceGroupName)
workspaceName := "my-workspace"
requestBody.SetWorkspaceName(&workspaceName)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
resourceConnections, err := graphClient.Admin().Windows().Updates().ResourceConnections().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.models.windowsupdates.OperationalInsightsConnection resourceConnection = new com.microsoft.graph.beta.models.windowsupdates.OperationalInsightsConnection();
resourceConnection.setOdataType("#microsoft.graph.windowsUpdates.operationalInsightsConnection");
resourceConnection.setAzureSubscriptionId("322ec614-e9c2-4cd5-a55c-5711fdecf02e");
resourceConnection.setAzureResourceGroupName("target-resource-group");
resourceConnection.setWorkspaceName("my-workspace");
com.microsoft.graph.models.windowsupdates.ResourceConnection result = graphClient.admin().windows().updates().resourceConnections().post(resourceConnection);
const options = {
authProvider,
};
const client = Client.init(options);
const resourceConnection = {
'@odata.type': '#microsoft.graph.windowsUpdates.operationalInsightsConnection',
azureSubscriptionId: '322ec614-e9c2-4cd5-a55c-5711fdecf02e',
azureResourceGroupName: 'target-resource-group',
workspaceName: 'my-workspace'
};
await client.api('/admin/windows/updates/resourceConnections')
.version('beta')
.post(resourceConnection);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\WindowsUpdates\OperationalInsightsConnection;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new OperationalInsightsConnection();
$requestBody->setOdataType('#microsoft.graph.windowsUpdates.operationalInsightsConnection');
$requestBody->setAzureSubscriptionId('322ec614-e9c2-4cd5-a55c-5711fdecf02e');
$requestBody->setAzureResourceGroupName('target-resource-group');
$requestBody->setWorkspaceName('my-workspace');
$result = $graphServiceClient->admin()->windows()->updates()->resourceConnections()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.WindowsUpdates
$params = @{
"@odata.type" = "#microsoft.graph.windowsUpdates.operationalInsightsConnection"
azureSubscriptionId = "322ec614-e9c2-4cd5-a55c-5711fdecf02e"
azureResourceGroupName = "target-resource-group"
workspaceName = "my-workspace"
}
New-MgBetaWindowsUpdatesResourceConnection -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.windows_updates.operational_insights_connection import OperationalInsightsConnection
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = OperationalInsightsConnection(
odata_type = "#microsoft.graph.windowsUpdates.operationalInsightsConnection",
azure_subscription_id = "322ec614-e9c2-4cd5-a55c-5711fdecf02e",
azure_resource_group_name = "target-resource-group",
workspace_name = "my-workspace",
)
result = await graph_client.admin.windows.updates.resource_connections.post(request_body)
応答
次の例は応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.windowsUpdates.operationalInsightsConnection",
"id": "85fbecb2-e407-34e9-9298-4d587857795d",
"azureSubscriptionId": "322ec614-e9c2-4cd5-a55c-5711fdecf02e",
"azureResourceGroupName": "target-resource-group",
"workspaceName": "my-workspace",
"state": "connected"
}