This TodoList app is an Azure Java application. It provides end-to-end CRUD operation to todo list item from front-end AngularJS code. Behind the scene, todo list item data store is Azure CosmosDB DocumentDB. Credentials of Azure Cosmos DB is stored as Azure Key Vault Secrets. This application uses Azure CosmosDB DocumentDB Spring Boot Starter, Azure Key Vault Secrets Spring Boot Starter and AngularJS to interact with Azure. This sample application provides several deployment options to deploy to Azure, pls see deployment section below. With Azure support in Spring Starters, maven plugins and Eclipse/IntelliJ plugins, Azure Java application development and deployment is effortless now.
- Run ansible from Visual Studio Code
- From Terminal.
- On Windows, run ansible inside docker.
- On Non-windows platform, provide option to run ansible from docker or from local ansible installation.
- From Cloud Shell.
Run ansible from cloud shell
- From Terminal.
- Requirements
- Create Azure Cosmos DB documentDB
- Configuration
- Run it
- Contribution
- Add new features
- Deployment
You can follow our steps using Azure CLI 2.0 to deploy an Azure Cosmos DB documentDB, or follow this article to create it from Azure portal.
-
login your Azure CLI, and set your subscription id
az login az account set -s <your-subscription-id>
-
create an Azure Resource Group, and note your group name
az group create -n <your-azure-group-name>
-
create Azure Cosmos DB with DocumentDB kind. Note the
documentEndpoint
field in the response.az cosmosdb create --kind GlobalDocumentDB -g <your-azure-group-name> -n <your-azure-documentDB-name>
-
get your Azure Cosmos DB key, get the
primaryMasterKey
of the DocumentDB you just created.az cosmosdb list-keys
You can follow this article to save credentials of Azure Cosmos DB in Azure Key Vault Secrets. Secrets keys should be:
- azure-documentdb-key
- azure-documentdb-uri
- azure-documentdb-database
Or you could follow our steps using Azure CLI 2.0 to save above credentials into Azure Key Vault Secrets.
- create one Azure service principal, and note your
appId
andpassword
in output.
az ad sp create-for-rbac --name <your-azure-service-principal-name>
- create Aazure Key Vault Secrets, note your
vaultUri
in output.
az keyvault create --name <your-vault-name> --resource-group <your-azure-resource-group-name> --location <your-azure-resource-group-location> --enabled-for-deployment true --enabled-for-disk-encryption true --enabled-for-template-deployment true --sku standard
- set Key Vault Policy, to assign permission to your service principal created at step 1.
az keyvault set-policy --name <your-vault-name> --secret-permission set get list delete --object-id <your-service-principal-id>
<your-service-principal-id>
is appId
you already noted at step 1.
- save credentials to Azure Key Vault Secrets.
az keyvault secret set --vault-name <your-vault-name> --name azure-documentdb-uri --value <your-azure-cosmosdb-uri>
az keyvault secret set --vault-name <your-vault-name> --name azure-documentdb-key --value <your-azure-cosmosdb-key>
az keyvault secret set --vault-name <your-vault-name> --name azure-documentdb-database --value <your-azure-cosmosdb-database>
- Note your Azure service principal
appId
,password
and Azure Key Vault Uri from above, then modifysrc/main/resources/application.properties
file and save it.
azure.keyvault.uri=put-your-keyvault-uri-here
azure.keyvault.client-id=put-your-service-principal-appid-here
azure.keyvault.client-key=put-your-service-principal-password-here
- package the project using
mvn package
- Run the project using
java -jar target/todo-app-java-on-azure-1.0-SNAPSHOT.jar
- Open
http://localhost:8080
you can see the web pages to show the todo list app
Delete the Azure resources you created by running the following command:
az group delete -y --no-wait -n <your-resource-group-name>
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.