Docs Home → MongoDB Command Line Interface
mongocli atlas networking peering create azure
On this page
mongocli atlas
commands are now deprecated because there's a new, dedicated CLI available for Atlas users. Migrate to the Atlas CLI to enjoy the same capabilities and the latest features. You can use mongocli atlas
commands until April 30, 2023.Create a network peering connection between the Atlas VPC and your Azure VNet.
Before you create an Azure network peering connection, complete the prerequisites listed here: https://www.mongodb.com/docs/atlas/reference/api/vpc-create-peering-connection/#prerequisites.
The network peering create command checks if a VNet exists in the region you specify for your Atlas project. If one exists, this command creates the peering connection between that VNet and your VPC. If an Atlas VPC does not exist, this command creates one and creates a connection between it and your VNet.
To learn more about network peering connections, see https://www.mongodb.com/docs/atlas/security-vpc-peering/.
To use this command, you must authenticate with a user account or an API key that has the Project Owner role.
Syntax
mongocli atlas networking peering create azure [options]
Options
Name | Type | Required | Description |
---|---|---|---|
--atlasCidrBlock | string | false | CIDR block that Atlas uses for all network peering connections created in the project. Required only if you do not already have an Atlas VPC. To learn more, see the Atlas UI tab at https://www.mongodb.com/docs/atlas/security-vpc-peering/#in-configure-your-network-peering-connection. |
--directoryId | string | true | Unique identifier for an Azure AD directory. |
-h, --help | false | help for azure | |
-o, --output | string | false | Output format. Valid values are json, json-path, go-template, or go-template-file. To see full output, use the -o json option. |
--projectId | string | false | Hexadecimal string that identifies the project to use. This option overrides the settings in the configuration file or environment variable. |
--region | string | true | Cloud provider region where the VPC that you peered with the Atlas VPC resides. |
--resourceGroup | string | true | Name of your Azure resource group. |
--subscriptionId | string | true | Unique identifier of the Azure subscription in which the VNet resides. |
--vnet | string | true | Name of your Azure VNet. |
Inherited Options
Name | Type | Required | Description |
---|---|---|---|
-P, --profile | string | false | Name of the profile to use from your configuration file. To learn about profiles for MongoCLI, see https://dochub.mongodb.org/core/atlas-cli-configuration-file. |
Output
If the command succeeds, the CLI returns output similar to the following sample. Values in brackets represent your values.
Network peering connection '<Id>' created.
Examples
# Create a network peering connection between the Atlas VPC in CIDR block 192.168.0.0/24 and your Azure VNet named atlascli-test in in US_EAST_2: mongocli atlas networking peering create azure --atlasCidrBlock 192.168.0.0/24 --directoryId 56657fdb-ca45-40dc-fr56-77fd8b6d2b37 --subscriptionId 345654f3-77cf-4084-9e06-8943a079ed75 --resourceGroup atlascli-test --region US_EAST_2 --vnet atlascli-test