Skip to content

Command is not correct #12052

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 3 commits into from
Jun 11, 2020
Merged

Command is not correct #12052

merged 3 commits into from
Jun 11, 2020

Conversation

ms-ishiyam
Copy link
Contributor

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, "")

Description

Checklist

  • I have read the Submitting Changes section of CONTRIBUTING.md
  • The title of the PR is clear and informative
  • The appropriate ChangeLog.md file(s) has been updated:
    • For any service, the ChangeLog.md file can be found at src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md
    • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header -- no new version header should be added
  • The PR does not introduce breaking changes
  • If applicable, the changes made in the PR have proper test coverage
  • For public API changes to cmdlets:
    • a cmdlet design review was approved for the changes in this repository (Microsoft internal only)
    • the markdown help files have been regenerated using the commands listed here

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, "")
@ms-ishiyam ms-ishiyam requested a review from anton-evseev as a code owner June 3, 2020 09:35
@adxsdkps
Copy link
Collaborator

adxsdkps commented Jun 3, 2020

Can one of the admins verify this patch?

@@ -37,7 +37,7 @@ This command gets an application gateway named ApplicationGateway01 and then add
```
PS C:\> $AppGW = Get-AzApplicationGateway -Name "ApplicationGateway01" -ResourceGroupName "ResourceGroup01"
PS C:\> $secret = Get-AzKeyVaultCertificate -VaultName "keyvault01" -Name "sslCert01"
PS C:\> $secretId = $secret.Id.Replace($secret.Version, "") # https://<keyvaultname>.vault.azure.net/secrets/
PS C:\> $secretId = $certificate.SecretId.Replace($certificate.Version, "") # https://<keyvaultname>.vault.azure.net/secrets/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you point me where "$certificate" was defined?

@VeryEarly VeryEarly self-assigned this Jun 4, 2020
@ms-ishiyam
Copy link
Contributor Author

ms-ishiyam commented Jun 4, 2020 via email

This command is correct.

$secretId = $secret.SecretId.Replace($secret.Version, "")
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/
@VeryEarly
Copy link
Collaborator

/azp run

@VeryEarly VeryEarly closed this Jun 8, 2020
@VeryEarly VeryEarly reopened this Jun 8, 2020
@azure-pipelines
Copy link
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

@VeryEarly
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

@VeryEarly
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

@VeryEarly VeryEarly merged commit 43ae2ac into master Jun 11, 2020
@wyunchi-ms wyunchi-ms deleted the hisasima-patch-1 branch April 12, 2023 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants