I am trying to create a VPN-connection via AzureCLI but only –local-gateway2 is giving error below:
According to official Microsoft documentation, this should be correct:
https://learn.microsoft.com/en-us/cli/azure/network/vpn-connection?view=azure-cli-latest
stages:
- stage: Deploy_VPN_Connection
jobs:
- job: Create_IPSec_VPN_Connection
continueOnError: false
steps:
- task: AzureCLI@2
displayName: 'Create_IPSec_VPN_Connection'
inputs:
azureSubscription: '$(ServiceConnectionName)' # Use Service Connection to deploy the code to Azure.
ScriptType: 'bash'
scriptLocation: 'inlineScript'
InlineScript: | # Powershell Inline commands
# Select Subscription to use
az account set --subscription '$(SubscriptionName)'
# Retrieve the shared key from Key Vault
# SHARED_KEY=$(az keyvault secret show --vault-name '($KeyVaultName)' --name '($SecretName)' --query value -o tsv)
# Deploy IPsec VPN Site-to-Site in Azure
az network vpn-connection create
--name '($VPNConnectionName)'
--resource-group '($ResourceGroupName)'
--location '($Location)'
--vnet-gateway1 '($VNetGatewayName)'
--shared-key 'TEST123!'
--local-gateway2 '($LocalNetworkGatewayName)'