Closed SwamyNallamalli closed 6 months ago
Thank you for your feedback. Tagging and routing to the team member best able to assist.
@SwamyNallamalli Based on version 1.5.1 of Azure.ResourceManager.Kusto, I tried to reproduce the test case of KustoDatabasePrincipalAssignment and tested the CreateOrUpdate() and GetAll() methods, and found no abnormalities. This is the code I used, I hope it will be of reference value to you:
public static async Task RunKustoTest(ArmClient client)
{
string rgName = "rg0308";
string vaultName = "test0308";
var lro1 = await client.GetDefaultSubscription().GetResourceGroups().CreateOrUpdateAsync(Azure.WaitUntil.Completed, rgName, new ResourceGroupData(AzureLocation.EastUS));
var resourceGroup = lro1.Value;
var clusterCollection = resourceGroup.GetKustoClusters();
var clusterName = "cluster0308";
var clusterDataCreate = new KustoClusterData(AzureLocation.EastUS, new Azure.ResourceManager.Kusto.Models.KustoSku(KustoSkuName.StandardE2aV4, KustoSkuTier.Standard)) { Identity = new ManagedServiceIdentity(ManagedServiceIdentityType.SystemAssigned), IsStreamingIngestEnabled = true };
var clusterResource = (await clusterCollection.CreateOrUpdateAsync(WaitUntil.Completed , clusterName, clusterDataCreate)).Value;
var databaseCollection = clusterResource.GetKustoDatabases();
var databaseName = "database0308";
var databaseData = new KustoReadWriteDatabase()
{
Location = AzureLocation.EastUS,
HotCachePeriod = TimeSpan.FromDays(2),
SoftDeletePeriod = TimeSpan.FromDays(3),
};
var databaseResource =(await databaseCollection.CreateOrUpdateAsync(WaitUntil.Completed, databaseName, databaseData)).Value;
var principalCollection = databaseResource.GetKustoDatabasePrincipalAssignments();
var principalName = "principal0308";
var databasePrincipalAssignmentDataCreate = new KustoDatabasePrincipalAssignmentData
{
DatabasePrincipalId = clusterResource.Data.Identity.PrincipalId.ToString(),
PrincipalType = KustoPrincipalAssignmentType.App,
Role = KustoDatabasePrincipalRole.Admin
};
var principalResource = (await principalCollection.CreateOrUpdateAsync(WaitUntil.Completed, principalName, databasePrincipalAssignmentDataCreate)).Value;
await foreach (var principal in principalCollection.GetAllAsync())
{
Console.WriteLine(principal.Id);
}
}
Hi @SwamyNallamalli. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.
I have the same question as mentioned in this thread. Even I'm getting the below exception while running
Message:
System.FormatException : One of the identified items was in an invalid format.
Stack Trace:
ThrowHelper.ThrowFormatException()
JsonElement.GetGuid()
KustoDatabasePrincipalAssignmentData.DeserializeKustoDatabasePrincipalAssignmentData(JsonElement element)
KustoDatabasePrincipalAssignmentCollection.
I have updated Azure.ResourceManager.Kusto to 1.5.1 from 1.4.0 but I see the issue in newer version too. PR reference: Pull request 9235419: [CG] Migrate E2E to Azure.ResourceManager.Kusto and Azure.ResourceManager.Kusto.Models - Repos (visualstudio.com) Line 142. I think the FormatException is thrown when I try to access existingPrincipalAssignment.Data.DatabasePrincipalId
The issue persists and I can repro in my local dev box.
I have the same question as mentioned in this thread. Even I'm getting the below exception while running
Message: System.FormatException : One of the identified items was in an invalid format. Stack Trace: ThrowHelper.ThrowFormatException() JsonElement.GetGuid() KustoDatabasePrincipalAssignmentData.DeserializeKustoDatabasePrincipalAssignmentData(JsonElement element) KustoDatabasePrincipalAssignmentCollection.b__9_1(JsonElement e) PageableImplementation`1.GetAsyncEnumerator(CancellationToken cancellationToken)+MoveNext() Boolean>.GetResult()
I have updated Azure.ResourceManager.Kusto to 1.5.1 from 1.4.0 but I see the issue in newer version too. PR reference: Pull request 9235419: [CG] Migrate E2E to Azure.ResourceManager.Kusto and Azure.ResourceManager.Kusto.Models - Repos (visualstudio.com) Line 142. I think the FormatException is thrown when I try to access existingPrincipalAssignment.Data.DatabasePrincipalId
The issue persists and I can repro in my local dev box.
@Vidyashreebn According to the screenshot and error message, the problem may be caused by the assignment of parameters. However, I am not sure what parameters you passed when calling this method, so it is difficult for me to determine whether the error is caused by the parameters. But according to my test results, there seems to be no problem with the SDK method itself when using regular parameters. So for now, we can only assume that the problem is caused by incorrect parameter passing.
Hi @SwamyNallamalli, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!
Library name and version
Azure.ResourceManager.Kusto 1.3.0.0
Describe the bug
When accessing the principals using the code from https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.Kusto_1.3.0/sdk/kusto/Azure.ResourceManager.Kusto/samples/Generated/Samples/Sample_KustoDatabasePrincipalAssignmentCollection.cs hitting the exception
System.FormatException HResult=0x80131537 Message=One of the identified items was in an invalid format. Source=System.Text.Json StackTrace: at System.Text.Json.ThrowHelper.ThrowFormatException() at System.Text.Json.JsonElement.GetGuid() at Azure.ResourceManager.Kusto.KustoDatabasePrincipalAssignmentData.DeserializeKustoDatabasePrincipalAssignmentData(JsonElement element) at Azure.ResourceManager.Kusto.KustoDatabasePrincipalAssignmentCollection.b__10_1(JsonElement e)
at Azure.Core.PageableHelpers.PageableImplementation`1.d__17.MoveNext()
There is no way to look at what row is causing the data or skipping that row and proceeding ahead. The specific issue seem to be other places when some guid is expected and is null, but is there a workaround?
Expected behavior
Reading the principals using the collection should provide the enumerator with all the list of users
Actual behavior
FormatException is getting thrown after the first user. First user is myself. The remaining users are not showing up or enumerator is not forwarding as the next entry is failing deserialization.
Reproduction Steps
`
ResourceIdentifier kustoDatabaseResourceId = KustoDatabaseResource.CreateResourceIdentifier("6c6bfab7-262d-4277-bc68-ec0fd783ba1e", "PPECommandAndControl", "ppesimselfkusto", "Logs");
`
Running the above code is throwing exception
Environment
Reading principles from Kusto database