Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update custom.py
  • Loading branch information
Yueren-Wang authored Jan 14, 2021
commit afde3172ed3b1bfb8ab62899f5a0e091e0dc1f37
16 changes: 2 additions & 14 deletions src/azure-cli/azure/cli/command_modules/rdbms/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,23 +536,11 @@ def _get_server_key_name_from_uri(uri):
'''
import re

match = re.match(r'https://(.)+\.(managedhsm.azure.net|
managedhsm-preview.azure.net|
vault.azure.net|
vault-int.azure-int.net|
vault.azure.cn|
managedhsm.azure.cn|
vault.usgovcloudapi.net|
managedhsm.usgovcloudapi.net|
vault.microsoftazure.de|
managedhsm.microsoftazure.de|
vault.cloudapi.eaglex.ic.gov|
vault.cloudapi.microsoft.scloud)(:443)?\/keys/[^\/]+\/[0-9a-zA-Z]+$', uri)
match = re.match(r'https://(.)+\.(managedhsm.azure.net|managedhsm-preview.azure.net|vault.azure.net|vault-int.azure-int.net|vault.azure.cn|managedhsm.azure.cn|vault.usgovcloudapi.net|managedhsm.usgovcloudapi.net|vault.microsoftazure.de|managedhsm.microsoftazure.de|vault.cloudapi.eaglex.ic.gov|vault.cloudapi.microsoft.scloud)(:443)?\/keys/[^\/]+\/[0-9a-zA-Z]+$', uri)
Copy link
Contributor

Choose a reason for hiding this comment

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

please add comment to clarify what you do for regex.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you support Azure Stack cloud? It seems with your current regex, only some known could are supported. If there are new cloud supported, you will need to change the regex here, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

currently we do not support Azure stack.


if match is None:
raise CLIError('The provided uri is invalid. Please provide a valid Azure Key Vault key id. For example: '
'"https://YourVaultName.vault.azure.net/keys/YourKeyName/123" or
"https://ManagedHsmRegion.ManagedHsmName.managedhsm.azure.net/keys/YourKeyName/123"')
'"https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901" or "https://YourManagedHsmRegion.YourManagedHsmName.managedhsm.azure.net/keys/YourKeyName/01234567890123456789012345678901"')

vault = uri.split('.')[0].split('/')[-1]
key = uri.split('/')[-2]
Expand Down