AzureNamedKeyCredential Class
- java.
lang. Object - com.
azure. core. credential. AzureNamedKeyCredential
- com.
public final class AzureNamedKeyCredential
The AzureNamedKeyCredential is used to authenticate and authorize requests made to Azure services. It is specifically designed for scenarios where you need to authenticate using a key with a name identifier associated with it.
A key is a unique identifier or token that is associated with a specific user or application. It serves as a simple form of authentication to ensure that only authorized clients can access the protected resources or APIs. This authentication is commonly used for accessing certain services, such as Azure Tables and Azure Event Hubs. Each service may have its own specific way of using API keys, but the general concept remains the same.
The AzureNamedKeyCredential can be created for keys which have a name identifier associated with them.
Code Samples
Create a named credential for a service specific sas key.
AzureNamedKeyCredential azureNamedKeyCredential =
new AzureNamedKeyCredential("AZURE-SERVICE-SAS-KEY-NAME", "AZURE-SERVICE-SAS-KEY");
Constructor Summary
Constructor | Description |
---|---|
AzureNamedKeyCredential(String name, String key) |
Creates a credential with specified |
Method Summary
Modifier and Type | Method and Description |
---|---|
Azure |
getAzureNamedKey()
Retrieves the AzureNamedKey containing the name and key associated with this credential. |
Azure |
update(String name, String key)
Rotates the |
Methods inherited from java.lang.Object
Constructor Details
AzureNamedKeyCredential
public AzureNamedKeyCredential(String name, String key)
Creates a credential with specified name
that authorizes request with the given key
.
Parameters:
Method Details
getAzureNamedKey
public AzureNamedKey getAzureNamedKey()
Retrieves the AzureNamedKey containing the name and key associated with this credential.
Returns:
update
public AzureNamedKeyCredential update(String name, String key)
Rotates the name
and key
associated to this credential.
Parameters:
Returns:
AzureNamedKeyCredential
object.Applies to
Azure SDK for Java