use of com.azure.core.credential.TokenCredential in project azure-iot-sdk-java by Azure.
the class RoleBasedAuthenticationSample method main.
public static void main(String[] args) {
SamplesArguments parsedArguments = new SamplesArguments(args);
// Credentials can be built from types from the Azure Identity library like ClientSecretCredential.
// The Azure Identity library also defines other implementations of the TokenCredential interface such as
// DefaultAzureCredential, InteractiveBrowserCredential, and many others.
TokenCredential credential = new ClientSecretCredentialBuilder().tenantId(parsedArguments.getTenantId()).clientId(parsedArguments.getClientId()).clientSecret(parsedArguments.getClientSecret()).build();
// "my-azure-iot-hub.azure-devices.net" for example
String iotHubHostName = parsedArguments.getIotHubHostName();
String newDeviceId = runRegistryManagerSample(iotHubHostName, credential);
runTwinClientSample(iotHubHostName, credential, newDeviceId);
runServiceClientSample(iotHubHostName, credential, newDeviceId);
runJobClientSample(iotHubHostName, credential);
runDeviceMethodClientSample(iotHubHostName, credential, newDeviceId);
}
Aggregations