首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将数据摄取到Azure群集存储会给Kusto.Common.Svc.Exceptions.UnauthorizedOperationException带来错误

将数据摄取到Azure群集存储会给Kusto.Common.Svc.Exceptions.UnauthorizedOperationException带来错误
EN

Stack Overflow用户
提问于 2021-03-03 14:09:20
回答 2查看 237关注 0票数 1

--要使用流方法向Azure存储群集中添加插入数据。--摄取客户端已生成,但当尝试将新记录插入到群集表中时,如果出现授权错误,请注意,我已将我的帐户添加到access表中,并授予摄取数据的权限,但除此之外,请让我知道是否有任何待摄取数据的内容或任何指向将数据摄取到azure群集存储中的引用链接

代码语言:javascript
复制
 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(流,属性);我使用了下面的引用来向其中摄取数据。

代码语言:javascript
复制
  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 'msauser=username@gmail.com' 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'.'''
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2021-03-03 16:15:58

该错误指示您无权将数据插入到您尝试将数据插入到的特定表中。

请注意,具有“用户”访问权限的人员不能将数据摄取到不是由其创建的表中。

请确保您的身份拥有对特定表或数据库的"ingestor“权限。您可以通过Azure portal或使用适用的命令来执行此操作。

票数 3
EN

Stack Overflow用户

发布于 2021-03-04 11:47:02

@Avnera建议我正确的链接。虽然我想分享一些具体的命令来帮助我解决这个问题。

代码语言:javascript
复制
.add database Test admins ('msauser=username@gmail.com') 'User Name(gmail.com)'
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66451655

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档