ConfidentialLedgerClient.GetUser(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 Azure.Response GetUser (string userId, Azure.RequestContext context = default);
abstract member GetUser : string * Azure.RequestContext -> Azure.Response
override this.GetUser : string * Azure.RequestContext -> Azure.Response
Public Overridable Function GetUser (userId As String, Optional context As RequestContext = Nothing) As 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 GetUser and parse the result.
TokenCredential credential = new DefaultAzureCredential();
ConfidentialLedgerClient client = new ConfidentialLedgerClient(new Uri("http://localhost:3000"), credential);
Response response = client.GetUser("<userId>");
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("assignedRole").ToString());
This sample shows how to call GetUser with all parameters and parse the result.
TokenCredential credential = new DefaultAzureCredential();
ConfidentialLedgerClient client = new ConfidentialLedgerClient(new Uri("http://localhost:3000"), credential);
Response response = client.GetUser("<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