Skip to content

Latest commit

 

History

History
 
 

Java

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

readme.md

CosmosDBManagement

Overview

CosmosDBManagement.java is a Java application that utilizes the Azure SDK to manage Azure Cosmos DB resources. This sample demonstrates how to interact with Cosmos DB using the Azure Resource Manager (ARM) APIs, allowing users to create, update, and manage Cosmos DB accounts, databases, and containers.

Prerequisites

To run this application, ensure you have the following installed:

  • Java Development Kit (JDK): Version 8 or higher.
  • Maven: For managing dependencies.
  • Azure Account: You need an Azure subscription. If you don’t have one, you can create a free account.

Dependencies

The project uses Azure SDK libraries, which can be included in your Maven pom.xml file. Below are the relevant dependencies:

com.azure.resourcemanager azure-resourcemanager-resources 2.41.0 com.azure.resourcemanager azure-resourcemanager-cosmos 2.41.0 com.azure azure-identity 1.12.2 org.slf4j slf4j-simple 1.7.32 com.microsoft.graph microsoft-graph 3.7.0

Usage

  1. Clone the Repository (if applicable):

    git clone https://github.com/your-repo/CosmosDBManagement.git
    cd CosmosDBManagement
  2. Build the Project: Use Maven to build the project:

    mvn clean install
  3. Run the Application: Execute the application with the following command:

    mvn exec:java -Dexec.mainClass="com.example.CosmosDBManagement"

Functionality

This sample provides the following functionalities:

  • Authenticate: Uses DefaultAzureCredential to authenticate with Azure.
  • Manage Cosmos DB Accounts: Create, update, and delete Cosmos DB accounts.
  • Database and Container Management: Create and manage databases and containers within the Cosmos DB account.
  • Configure Autoscale Settings: Set autoscale configurations for containers.

Code Structure

  • CosmosDBManagement.java: The main class containing the logic for managing Cosmos DB resources.

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue for any enhancements or bug fixes.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Azure SDK for Java
  • Azure Cosmos DB Documentation