Skip to content

Commit 2cbb523

Browse files
authored
Improve Azure Storage Account name check to be more informative (#13)
Add Azure region name check and remediation advice Signed-off-by: Daniel Chaffelson <chaffelson@gmail.com>
1 parent 2144b94 commit 2cbb523

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

roles/infrastructure/tasks/validate_azure.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,21 @@
2828
fail_msg: "Azure authentication parameter, 'infra__public_key_text', is invalid. Either set this variable or specify 'infra__public_key_file'."
2929
quiet: yes
3030

31-
- name: Check storage name
31+
- name: Check Azure Region - {{ common__azure_region }}
32+
ansible.builtin.assert:
33+
that:
34+
- "common__azure_region is match(regex1)"
35+
fail_msg: "Azure region value 'common__azure_region' with value '{{ common__azure_region }}' is not valid, it is typically lowercase letters and numbers with no spaces. Consider running 'az account list-locations -o table' in Azure CLI for a current listing."
36+
quiet: yes
37+
vars:
38+
regex1: '^([a-z0-9]+)$'
39+
40+
- name: Check storage name - {{ infra__azure_storage_name }}
3241
ansible.builtin.assert:
3342
that:
3443
- "infra__azure_storage_name | trim | length < 25"
3544
- "infra__azure_storage_name is match(regex1)"
36-
fail_msg: "Azure storage name parameter, 'infra__azure_storage_name', is invalid. Azure requires lowercase letters and numbers only and 24 characters or less."
45+
fail_msg: "Azure storage name parameter, 'infra__azure_storage_name' with value '{{ infra__azure_storage_name }}', is invalid. Azure requires lowercase letters and numbers only and 24 characters or less. Please check your name_prefix and any suffix modifications."
3746
quiet: yes
3847
vars:
3948
regex1: '^([a-z0-9]+)$'

0 commit comments

Comments
 (0)