services | platforms | author |
---|---|---|
key-vault |
java |
tiffanyachen |
This sample repo includes sample code demonstrating common mechanisms for managing storage account keys using Key Vault.
- KeyVaultManagedStorageSample
- demonstrateStorageAccountManagement - creates a storage account and then adds the storage account to the vault to manage its keys
- updateStorageAccount - updates a storage account in the vault
- regenerateStorageAccountKeys - regenerates a key of a storage account managed by the vault
- getStorageAccounts - lists the storage accounts in the vault, then gets each
- deletStorageAccount - deletes a storage account from the vault
- SasDefinitionSample
- createAccountSasDefinition - creates an account SAS definition to manage storage account and its entities
- createBlobSasDefinition - creates a service SAS definition to manage access to a blob container
- getSasDefinition - lists and gets each of the sas definitions for this account
- Java 1.7+
- An Azure Service Principal, through Azure CLI, PowerShell or Azure Portal.
-
If not installed, install Java.
-
Clone the repository.
git clone https://github.com/Azure-Samples/key-vault-java-authentication.git
-
Create an Azure service principal, using Azure CLI, PowerShell or Azure Portal. Note that if you wish to authenticate with the certificate authenticator the certificate should be saved locally.
-
Export these environment variables into your current shell or IDE.
AZURE_TENANT_ID={your tenant id}
RESOURCE_GROUP={your resource group}
- Run main.java for a sample run through. This project uses maven so you can do so either through an IDE or on the command line.