gpt4 book ai didi

c# - 将数据引入 Azure 群集存储会出现 Kusto.Common.Svc.Exceptions.UnauthorizedOperationException 错误

转载 作者:行者123 更新时间:2023-12-02 23:16:03 33 4
gpt4 key购买 nike

--想要使用流方法将插入数据添加到Azure存储集群中。--生成了摄取客户端,但是当尝试将新记录插入集群表时,它会给出授权错误,请注意,我已添加我的帐户来访问表,并授予摄取数据的权限除此之外,请告诉我是否有任何待提取数据的事项或将数据提取到 azure 集群​​存储的任何引用链接

 var tempObject = new { starttime = startTime, endtime = endTime, trigger = rowKey, 
interval = "", site="",asset = asset,property = "",
aggregate = "", value = "",normal ="",
nvalue = "", svalue = "", meta = ""
};
var stringJson = JsonConvert.SerializeObject(tempObject);
var kustoUri = "https://{cluster}.{region}.kusto.windows.net";
var ingestUri = "https://ingest-{cluster}.{region}.kusto.windows.net";
string database = "abcd";
var kustoConnectionStringBuilder =
new KustoConnectionStringBuilder(ingestUri)
{
FederatedSecurity = true,
InitialCatalog = database,
Authority = "{tenantID}"
};


var ingestClient = KustoIngestFactory.CreateQueuedIngestClient(kustoConnectionStringBuilder);
var table = "TableName";
var tableMapping = "TableMapping";

var properties =
new KustoQueuedIngestionProperties(database, table)
{
Format = DataSourceFormat.multijson,
IngestionMapping = new IngestionMapping()
{
IngestionMappingReference = tableMapping
}
};
// convert string to stream
byte[] byteArray = Encoding.UTF8.GetBytes(stringJson);
//byte[] byteArray = Encoding.ASCII.GetBytes(contents);
MemoryStream stream = new MemoryStream(byteArray);
ingestClient.IngestFromStream(stream, properties);

以下错误我得到@ line ingestClient.IngestFromStream(stream,properties);我使用以下引用将数据提取到其中。

  Kusto.Ingest.Exceptions.IngestionResourcesNotFoundException: 'No ingestion resources were returned from Kusto endpoint. Error: 'An exception was thrown while attempting to retrieve resources from endpoint : 'https://ingest-{cluster}.{region}.kusto.windows.net'. 'Forbidden (403-Forbidden): {
"error": {
"code": "Forbidden",
"message": "Caller is not authorized to perform this action",
"@type": "Kusto.Common.Svc.Exceptions.UnauthorizedOperationException",
"@message": "Principal '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d6bba5b7a3a5b3a4eba3a5b3a4b8b7bbb396b1bbb7bfbaf8b5b9bb" rel="noreferrer noopener nofollow">[email protected]</a>' is not authorized to perform operation 'Access the Kusto DM service for Ingest on any of the cluster's databases' on '[unspecified target]'.",
"@context": {
"timestamp": "2021-03-03T02:24:06.4434620Z",
"serviceAlias": "INGEST-RDDATAEXPLORERCLUSTER1",
"machineName": "KDataMana000000",
"processName": "Kusto.WinSvc.DM.Svc",
"processId": 11984,
"threadId": 4852,
"appDomainName": "Kusto.WinSvc.DM.Svc.exe",
"clientRequestId": "KI.KustoQueuedIngestClient.IngestFromStream.121db307-20b0-4940-b5aa-cdfaf8b1d4bc;5af7c92f-c57a-4d9f-bf6a-885bbcc4a52e;c7deb2bd-76bf-42b3-8eaf-84f4aac04986;1",
"activityId": "22fdfdd9-5dc2-46cd-a9b2-9e829cf907ab",
"subActivityId": "7916a2e6-daeb-4913-a2cd-77d82669320d",
"activityType": "P.WCF.Service.ExecuteControlCommandInternal..IAdminClientServiceCommunicationContract",
"parentActivityId": "8da57be2-5ab4-438b-88eb-211af02a36f1",
"activityStack": "(Activity stack: CRID=KI.KustoQueuedIngestClient.IngestFromStream.121db307-20b0-4940-b5aa-cdfaf8b1d4bc;5af7c92f-c57a-4d9f-bf6a-885bbcc4a52e;c7deb2bd-76bf-42b3-8eaf-84f4aac04986;1 ARID=22fdfdd9-5dc2-46cd-a9b2-9e829cf907ab > DN.Admin.Client.ExecuteControlCommand/8da57be2-5ab4-438b-88eb-211af02a36f1 > P.WCF.Service.ExecuteControlCommandInternal..IAdminClientServiceCommunicationContract/7916a2e6-daeb-4913-a2cd-77d82669320d)"
},
"@permanent": true
}
}. This normally represents a permanent error, and retrying is unlikely to help.
Error details:
DataSource='https://{cluster}.{region}.australiaeast.kusto.windows.net:443/v1/rest/mgmt',
DatabaseName='database name',
ClientRequestId='KI.KustoQueuedIngestClient.IngestFromStream.121db307-20b0-4940-b5aa-cdfaf8b1d4bc;5af7c92f-c57a-4d9f-bf6a-885bbcc4a52e;c7deb2bd-76bf-42b3-8eaf-84f4aac04986;1',
ActivityId='22fdfdd9-5dc2-46cd-a9b2-9e829cf907ab,
Timestamp='2021-03-03T02:24:04.6431925Z'.'''

最佳答案

该错误表明您无权将数据提取到您尝试将数据提取到的特定表中。

请注意,具有“用户”访问权限的人无法将数据提取到不是由该人创建的表中。

请确保您的身份对特定表或数据库具有“摄取者”权限。您可以通过 Azure portal 来完成或使用适用的命令。

关于c# - 将数据引入 Azure 群集存储会出现 Kusto.Common.Svc.Exceptions.UnauthorizedOperationException 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66451655/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com