Skip to content

Commit 43ae2ac

Browse files
authored
Command is not correct (#12052)
* Command is not correct We can use this command for secret not certificates because this command is not correct for certificates of KeyVault. When we use this command, the id will be below. I think this id is not correct for AppGW. https://xxxxx.vault.azure.net:443/certificates/xxxx/ The should be below. "KeyVaultSecretId": "https://xxxx.vault.azure.net:443/secrets/xxxx/" When I used below command, I encountered error. $secretId = $secret.Id.Replace($secret.Version, "") "Set-AzApplicationGateway : SecretId 'https://xxxx.vault.azure.net:443/certificates/selftest/' specified in '/subscriptions/xxxxxxxxx/resourceGroups/apgw/p roviders/Microsoft.Network/applicationGateways/AppGW/sslCertificates/SelfKeyCert' is invalid." When I used below command, the operation was successful. So I think this document is not correct. $secretId = $certificate.SecretId.Replace($certificate.Version, "") * Command is not correct This command is correct. $secretId = $secret.SecretId.Replace($secret.Version, "") * This command is correct. I made a mistake. This is corrct. Before $secret.Id.Replace($secret.Version, "") After $secret.SecretId.Replace($secret.Version, "") The Reason. If we use below command, the URL will be "/certificates/" and it's invalid URL for AppGW. $secretId = $secret.Id.Replace($secret.Version, "") > $secretId https://testxxxx.vault.azure.net:443/certificates/testself/ So below command is correct. $secretId = $secret.SecretId.Replace($secret.Version, "") > $secretId https://testxxxxxx.vault.azure.net:443/secrets/testself/
1 parent d17d1e7 commit 43ae2ac

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Network/Network/help/Add-AzApplicationGatewaySslCertificate.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ This command gets an application gateway named ApplicationGateway01 and then add
3737
```
3838
PS C:\> $AppGW = Get-AzApplicationGateway -Name "ApplicationGateway01" -ResourceGroupName "ResourceGroup01"
3939
PS C:\> $secret = Get-AzKeyVaultCertificate -VaultName "keyvault01" -Name "sslCert01"
40-
PS C:\> $secretId = $secret.Id.Replace($secret.Version, "") # https://<keyvaultname>.vault.azure.net/secrets/
40+
PS C:\> $secretId = $secret.SecretId.Replace($secret.Version, "") # https://<keyvaultname>.vault.azure.net/secrets/
4141
PS C:\> $AppGW = Add-AzApplicationGatewaySslCertificate -ApplicationGateway $AppGW -Name "Cert01" -KeyVaultSecretId $secretId
4242
```
4343

0 commit comments

Comments
 (0)