Azure / Azure/azure-cli

Can't Create VPN-SITE on Virtual Wan with **--site-key** parameter for az network vpn-site module

Open
#18,902 10 comments 0 reactions 1 assignee Claimed by @kairu-ms View on GitHub
act-quality-productivity-squad feature-request Network Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

## Can't Create VPN-SITE on Virtual Wan with **--site-key** parameter for az network vpn-site module

I've configured a Virtual Wan to migrate my Site-To-Site VPNs from Azure VPN Gateway. How i have lot's of VPNs i was trying to use az cli with module (vpn-site) that are in preview to automate the creation of the connections.
I can create the connection, but only without the Pre-SharedKey that we pass trough the --site-key parameter.
When I try to pass the Pré-Shared Key for the command it outputs an erro like:

**(InvalidRequestFormat) Cannot parse the request**

---
#### Document Details

Looking at the debug logs i could find that the az cli try to file the propertie **siteKey** on the 'VpnSiteProperties' on the path 'properties.siteKey', like you can see bellow:

` **azure.core.pipeline.policies._universal: {
"error": {
"code": "InvalidRequestFormat",
"message": "Cannot parse the request.",
"details": [
{
"code": "InvalidJson",
"message": "Could not find member 'siteKey' on object of type 'VpnSiteProperties'. Path 'properties.siteKey', line 1, position 260."
}
]
}
}**
cli.azure.cli.core.util: azure.cli.core.util.handle_exception is called with an exception:
cli.azure.cli.core.util: Traceback (most recent call last):
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 660, in execute
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 723, in _run_jobs_serially
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 716, in _run_job
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\six.py", line 703, in reraise
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 694, in _run_job
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 331, in __call__
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/__init__.py", line 811, in default_command_handler
File "C:\Users\rodolfo.santos\.azure\cliextensions\virtual-wan\azext_vwan\custom.py", line 671, in create_vpn_site
resource_group_name, vpn_site_name, site)
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/util.py", line 638, in sdk_no_wait
File "C:\Users\rodolfo.santos\.azure\cliextensions\virtual-wan\azext_vwan\vendored_sdks\v2020_05_01\v2020_05_01\operations\_vpn_sites_operations.py", line 206, in begin_create_or_update
**kwargs
File "C:\Users\rodolfo.santos\.azure\cliextensions\virtual-wan\azext_vwan\vendored_sdks\v2020_05_01\v2020_05_01\operations\_vpn_sites_operations.py", line 153, in _create_or_update_initial
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
azure.core.exceptions.HttpResponseError: (InvalidRequestFormat) Cannot parse the request.

cli.azure.cli.core.azclierror: (InvalidRequestFormat) Cannot parse the request.
cli.azure.cli.core.azclierror: (InvalidRequestFormat) Cannot parse the request.
`

## The property exists

So I tried to find this property.
**I've execute the command az network vpn-site show -n -r **
The anwser is thtat the property exists!

`{
"addressSpace": {
"addressPrefixes": [
"172.31.11.40/32"
]
},
"bgpProperties": null,
"deviceProperties": {
"deviceModel": null,
"deviceVendor": null,
"linkSpeedInMbps": 0
},
"etag": "W/\"eca3f4c6-ab9f-448a-aa38-323bb9c18d01\"",
"id": "/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxx/resourceGroups/PRD-Network/providers/Microsoft.Network/vpnSites/XPTO",
"ipAddress": "200.142.xxx.xxx",
"isSecuritySite": false,
"location": "eastus",
"name": "XPTO",
"provisioningState": "Succeeded",
"resourceGroup": "PRD-Network",
"siteKey": null,
"tags": null,
"type": "Microsoft.Network/vpnSites",
"virtualWan": {
"id": "/subscriptions/XXXXXXXXXXX/resourceGroups/PRD-Network/providers/Microsoft.Network/virtualWans/cccccc",
"resourceGroup": "PRD-Network"
},
"vpnSiteLinks": null
}`

> ### Coud this be an expected error or this is a Bug?

🤔

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: 98707ae0-4b97-266d-bf8e-0b98ee38b7b8
* Version Independent ID: dabe3cd9-844d-c2ec-b9e6-8ef3c9a428de
* Content: [az network vpn-site](https://docs.microsoft.com/en-us/cli/azure/network/vpn-site?view=azure-cli-latest#az_network_vpn_site_create)
* Content Source: [latest/docs-ref-autogen/network/vpn-site.yml](https://github.com/MicrosoftDocs/azure-docs-cli/blob/master/latest/docs-ref-autogen/network/vpn-site.yml)
* Service: **virtual-network**
* GitHub Login: @rloutlaw
* Microsoft Alias: **routlaw**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.