Azure / Azure/azure-powershell
Deprecated property - Update-AzVpnConnection
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 51
Description
### Description
The PoSH cmdlet
Update-AzVpnConnection
https://learn.microsoft.com/en-us/powershell/module/az.network/update-azvpnconnection?view=azps-11.5.0
Appears to be deprecated, whereby any attempts to update any parameters per the documentation yield an error stating:
Update request for VpnConnection contains deprecated property. Please use corresponding VpnSiteLinkConnection property instead.
There is no corresponding VpnSiteLinkConnection cmdlet to suffice Updates or Sets, only Get, New and Reset.
https://learn.microsoft.com/en-us/powershell/module/az.network/get-azvpnsitelinkconnectionikesa?view=azps-11.4.0
https://learn.microsoft.com/en-us/powershell/module/az.network/new-azvpnsitelinkconnection?view=azps-11.5.0
https://github.com/Azure/azure-powershell/blob/master/src/Network/Network/help/Reset-AzVpnSiteLinkConnection.md
In the Azure Portal, it appears as though when attempting to manipulate this particular resource, you are prompted to re-create existing resources (the button states "Review + Create" rather than "Save" - this implies to me that this is re-creating the resource everytime)
The documentation for the API
https://learn.microsoft.com/en-us/azure/templates/microsoft.network/vpnsites/vpnsitelinks?pivots=deployment-language-terraform
Also suggests that this is a read only resource, thus changes are implied to be overwrites/recreations.
Is this expected behaviour? If not, is there any way to update the SharedKey (Pre-shared key/PSK) programmatically without recreating the entire resource?
### Issue script & Debug output
```PowerShell
PS C:\> Update-AzVpnConnection -InputObject $con1 -SharedKey $sharedKey -VpnSiteLinkConnection $aws1 -WhatIf
Update-AzVpnConnection : Update request for VpnConnection contains deprecated property. Please
use corresponding VpnSiteLinkConnection property instead.
At line:1 char:1
+ Update-AzVpnConnection -InputObject $con1 -SharedKey $sharedKey -VpnS ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Update-AzVpnConnection], PSArgumentException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Network.Cortex.VpnGateway.UpdateAzureRmVpn
ConnectionCommand
```
### Environment data
```PowerShell
PS C:\> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.22621.2506
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22621.2506
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
```
### Module versions
```PowerShell
PS C:\> Get-Module Az*
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 2.15.1 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-Az...
Script 7.4.0 Az.Network {Add-AzApplicationGatewayAuthenticationCerti...
Script 6.15.1 Az.Resources {Export-AzResourceGroup, Export-AzTemplateSp...
```
### Error output
```PowerShell
PS C:\> Resolve-AzError
HistoryId: 121
Message : Update request for VpnConnection contains deprecated property. Please use corresponding
VpnSiteLinkConnection property instead.
StackTrace : at Microsoft.Azure.Commands.Network.Cortex.VpnGateway.UpdateAzureRmVpnConnectionComma
nd.Execute()
at Microsoft.Azure.Commands.Network.NetworkBaseCmdlet.ExecuteCmdlet()
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception : System.Management.Automation.PSArgumentException
InvocationInfo : {Update-AzVpnConnection}
Line : Update-AzVpnConnection -InputObject $con1 -SharedKey $sharedKey -VpnSiteLinkConnection
$aws1 -WhatIf
Position : At line:1 char:1
+ Update-AzVpnConnection -InputObject $con1 -SharedKey $sharedKey -VpnS ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 121
```
Contributor guide
Assessment
This issue has not been assessed yet.