ConfidentialLedgerClient.GetUserAsync(String, RequestContext) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
[Protocol Method] Gets a user.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
public virtual System.Threading.Tasks.Task<Azure.Response> GetUserAsync (string userId, Azure.RequestContext context = default);
abstract member GetUserAsync : string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.GetUserAsync : string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function GetUserAsync (userId As String, Optional context As RequestContext = Nothing) As Task(Of Response)
Parameters
- userId
- String
The user id, either an AAD object ID or certificate fingerprint.
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The response returned from the service.
Exceptions
userId
is null.
Service returned a non-success status code.
Examples
This sample shows how to call GetUserAsync and parse the result.
TokenCredential credential = new DefaultAzureCredential();
ConfidentialLedgerClient client = new ConfidentialLedgerClient(new Uri("http://localhost:3000"), credential);
Response response = await client.GetUserAsync("<userId>");
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("assignedRole").ToString());
This sample shows how to call GetUserAsync with all parameters and parse the result.
TokenCredential credential = new DefaultAzureCredential();
ConfidentialLedgerClient client = new ConfidentialLedgerClient(new Uri("http://localhost:3000"), credential);
Response response = await client.GetUserAsync("<userId>");
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("assignedRole").ToString());
Console.WriteLine(result.GetProperty("userId").ToString());
Remarks
Below is the JSON schema for the response payload.
Response Body:
Schema for LedgerUser
:
{
assignedRole: "Administrator" | "Contributor" | "Reader", # Required. Represents an assignable role.
userId: string, # Optional. Identifier for the user. This must either be an AAD object id or a certificate fingerprint.
}
Applies to
Azure SDK for .NET