@@ -6198,6 +6198,14 @@ def _build_arguments_schema(cls, *args, **kwargs):
61986198
61996199# region VirtualNetworkGatewayConnections
62006200# pylint: disable=too-many-locals
6201+ def _get_vpn_connection_aux_subscriptions (local_gateway , vnet_gateway ):
6202+ aux_subscriptions = []
6203+ _add_aux_subscription (aux_subscriptions , local_gateway )
6204+ _add_aux_subscription (aux_subscriptions , vnet_gateway )
6205+
6206+ return aux_subscriptions
6207+
6208+
62016209def create_vpn_connection (cmd , resource_group_name , connection_name , vnet_gateway1 ,
62026210 location = None , tags = None , no_wait = False , validate = False ,
62036211 vnet_gateway2 = None , express_route_circuit2 = None , local_gateway2 = None ,
@@ -6229,9 +6237,11 @@ def create_vpn_connection(cmd, resource_group_name, connection_name, vnet_gatewa
62296237 template = master_template .build ()
62306238 parameters = master_template .build_parameters ()
62316239
6240+ aux_subscriptions = _get_lb_create_aux_subscriptions (local_gateway2 , vnet_gateway2 )
6241+
62326242 # deploy ARM template
62336243 deployment_name = 'vpn_connection_deploy_' + random_string (32 )
6234- client = get_mgmt_service_client (cmd .cli_ctx , ResourceType .MGMT_RESOURCE_RESOURCES ).deployments
6244+ client = get_mgmt_service_client (cmd .cli_ctx , ResourceType .MGMT_RESOURCE_RESOURCES , aux_subscriptions = aux_subscriptions ).deployments
62356245 properties = DeploymentProperties (template = template , parameters = parameters , mode = 'incremental' )
62366246 Deployment = cmd .get_models ('Deployment' , resource_type = ResourceType .MGMT_RESOURCE_RESOURCES )
62376247 deployment = Deployment (properties = properties )
0 commit comments