-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Network]az network vnet-gateway: --vpn-auth-type allow multi value
#17505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3f3408e
create
msyyc 79ada4b
update
msyyc c9f3a1c
test
msyyc 62117cc
style
msyyc de8b4d7
Merge branch 'dev' of https://github.com/azure/azure-cli into network…
msyyc 1c6ba12
remove deprecation for --sku of public-ip
msyyc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6336,11 +6336,12 @@ def create_vnet_gateway(cmd, resource_group_name, virtual_network_gateway_name, | |
| no_wait=False, gateway_type=None, sku=None, vpn_type=None, vpn_gateway_generation=None, | ||
| asn=None, bgp_peering_address=None, peer_weight=None, | ||
| address_prefixes=None, radius_server=None, radius_secret=None, client_protocol=None, | ||
| gateway_default_site=None, custom_routes=None): | ||
| gateway_default_site=None, custom_routes=None, aad_tenant=None, aad_audience=None, | ||
| aad_issuer=None, root_cert_data=None, root_cert_name=None, vpn_auth_type=None): | ||
| (VirtualNetworkGateway, BgpSettings, SubResource, VirtualNetworkGatewayIPConfiguration, VirtualNetworkGatewaySku, | ||
| VpnClientConfiguration, AddressSpace) = cmd.get_models( | ||
| VpnClientConfiguration, AddressSpace, VpnClientRootCertificate) = cmd.get_models( | ||
| 'VirtualNetworkGateway', 'BgpSettings', 'SubResource', 'VirtualNetworkGatewayIPConfiguration', | ||
| 'VirtualNetworkGatewaySku', 'VpnClientConfiguration', 'AddressSpace') | ||
| 'VirtualNetworkGatewaySku', 'VpnClientConfiguration', 'AddressSpace', 'VpnClientRootCertificate') | ||
|
|
||
| client = network_client_factory(cmd.cli_ctx).virtual_network_gateways | ||
| subnet = virtual_network + '/subnets/GatewaySubnet' | ||
|
|
@@ -6371,6 +6372,16 @@ def create_vnet_gateway(cmd, resource_group_name, virtual_network_gateway_name, | |
| vnet_gateway.vpn_client_configuration.radius_server_address = radius_server | ||
| vnet_gateway.vpn_client_configuration.radius_server_secret = radius_secret | ||
|
|
||
| # multi authentication | ||
| if cmd.supported_api_version(min_api='2020-11-01'): | ||
| vnet_gateway.vpn_client_configuration.vpn_authentication_types = vpn_auth_type | ||
| vnet_gateway.vpn_client_configuration.aad_tenant = aad_tenant | ||
| vnet_gateway.vpn_client_configuration.aad_issuer = aad_issuer | ||
| vnet_gateway.vpn_client_configuration.aad_audience = aad_audience | ||
| vnet_gateway.vpn_client_configuration.vpn_client_root_certificates = [ | ||
| VpnClientRootCertificate(name=root_cert_name, | ||
| public_cert_data=root_cert_data)] if root_cert_data else None | ||
|
|
||
| if custom_routes and cmd.supported_api_version(min_api='2019-02-01'): | ||
| vnet_gateway.custom_routes = AddressSpace() | ||
| vnet_gateway.custom_routes.address_prefixes = custom_routes | ||
|
|
@@ -6383,9 +6394,11 @@ def update_vnet_gateway(cmd, instance, sku=None, vpn_type=None, tags=None, | |
| public_ip_address=None, gateway_type=None, enable_bgp=None, | ||
| asn=None, bgp_peering_address=None, peer_weight=None, virtual_network=None, | ||
| address_prefixes=None, radius_server=None, radius_secret=None, client_protocol=None, | ||
| gateway_default_site=None, custom_routes=None): | ||
| AddressSpace, SubResource, VirtualNetworkGatewayIPConfiguration, VpnClientConfiguration = cmd.get_models( | ||
| 'AddressSpace', 'SubResource', 'VirtualNetworkGatewayIPConfiguration', 'VpnClientConfiguration') | ||
| gateway_default_site=None, custom_routes=None, aad_tenant=None, aad_audience=None, | ||
| aad_issuer=None, root_cert_data=None, root_cert_name=None, vpn_auth_type=None): | ||
| (AddressSpace, SubResource, VirtualNetworkGatewayIPConfiguration, VpnClientConfiguration, | ||
| VpnClientRootCertificate) = cmd.get_models('AddressSpace', 'SubResource', 'VirtualNetworkGatewayIPConfiguration', | ||
| 'VpnClientConfiguration', 'VpnClientRootCertificate') | ||
|
|
||
| if any((address_prefixes, radius_server, radius_secret, client_protocol)) and not instance.vpn_client_configuration: | ||
| instance.vpn_client_configuration = VpnClientConfiguration() | ||
|
|
@@ -6401,6 +6414,15 @@ def update_vnet_gateway(cmd, instance, sku=None, vpn_type=None, tags=None, | |
| c.set_param('vpn_client_protocols', client_protocol) | ||
| c.set_param('radius_server_address', radius_server) | ||
| c.set_param('radius_server_secret', radius_secret) | ||
| if cmd.supported_api_version(min_api='2020-11-01'): | ||
| c.set_param('aad_tenant', aad_tenant) | ||
| c.set_param('aad_audience', aad_audience) | ||
| c.set_param('aad_issuer', aad_issuer) | ||
| c.set_param('vpn_authentication_types', vpn_auth_type) | ||
|
|
||
| if root_cert_data and cmd.supported_api_version(min_api='2020-11-01'): | ||
| upsert_to_collection(instance.vpn_client_configuration, 'vpn_client_root_certificates', | ||
| VpnClientRootCertificate(name=root_cert_name, public_cert_data=root_cert_data), 'name') | ||
|
Comment on lines
+6423
to
+6425
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question as above
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same reply as above |
||
|
|
||
| with cmd.update_context(instance.sku) as c: | ||
| c.set_param('name', sku) | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to throw error if user provide rout_cert_data but forget root_cert_name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
root_cert_data is necessary while root_cert_name is not.