Skip to content

Commit

Permalink
[storage-preview] az storage account create: Add `--dns-endpoint-ty…
Browse files Browse the repository at this point in the history
…pe` to support creating accounts in an Azure DNS Zone (#4664)

* `az storage account create`: Add `--dns-endpoint-type` to support creating accounts in an Azure DNS Zone

* Credential scan white list
  • Loading branch information
evelyn-ys authored Apr 12, 2022
1 parent 2eee2e5 commit 4dbb0b7
Show file tree
Hide file tree
Showing 72 changed files with 2,108 additions and 7,789 deletions.
4 changes: 4 additions & 0 deletions src/storage-preview/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
Release History
===============
0.8.2(2022-04-12)
++++++++++++++++++
* `az storage account create`: Add `--dns-endpoint-type` to support creating accounts in an Azure DNS Zone

0.8.1(2022-03-15)
++++++++++++++++++
* `az storage account create/update`: Support `--key-vault-federated-identity-client-id` and `--allowed-copy-scope`
Expand Down
2 changes: 1 addition & 1 deletion src/storage-preview/azext_storage_preview/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, cli_ctx=None):

register_resource_type('latest', CUSTOM_DATA_STORAGE, '2018-03-28')
register_resource_type('latest', CUSTOM_DATA_STORAGE_ADLS, '2019-02-02-preview')
register_resource_type('latest', CUSTOM_MGMT_STORAGE, '2021-08-01')
register_resource_type('latest', CUSTOM_MGMT_STORAGE, '2021-09-01')
register_resource_type('latest', CUSTOM_DATA_STORAGE_FILESHARE, '2020-02-10')
register_resource_type('latest', CUSTOM_DATA_STORAGE_FILEDATALAKE, '2020-06-12')

Expand Down
12 changes: 12 additions & 0 deletions src/storage-preview/azext_storage_preview/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,17 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem
options_list=['--allowed-copy-scope', '-s'], min_api='2021-08-01',
help='Restrict copy to and from Storage Accounts within an AAD tenant or with Private Links to the same VNet'
)
dns_endpoint_type_enum = self.get_sdk(
'models._storage_management_client_enums#DnsEndpointType',
resource_type=CUSTOM_MGMT_STORAGE
)
dns_endpoint_type_type = CLIArgumentType(
arg_type=get_enum_type(dns_endpoint_type_enum), is_preview=True,
options_list=['--dns-endpoint-type', '--endpoint'], min_api='2021-09-01',
help='Allow you to specify the type of endpoint. Set this to AzureDNSZone to create a large number of '
'accounts in a single subscription, which creates accounts in an Azure DNS Zone and the endpoint URL '
'will have an alphanumeric DNS Zone identifier.'
)
public_network_access_enum = self.get_sdk('models._storage_management_client_enums#PublicNetworkAccess',
resource_type=CUSTOM_MGMT_STORAGE)
num_results_type = CLIArgumentType(
Expand Down Expand Up @@ -289,6 +300,7 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem
arg_group='Account Level Immutability',
validator=validate_immutability_arguments)
c.argument('allowed_copy_scope', arg_type=allowed_copy_scope_type)
c.argument('dns_endpoint_type', arg_type=dns_endpoint_type_type)
c.argument('public_network_access', arg_type=get_enum_type(public_network_access_enum), min_api='2021-06-01',
help='Enable or disable public network access to the storage account. '
'Possible values include: `Enabled` or `Disabled`.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def create_storage_account(cmd, resource_group_name, account_name, sku=None, loc
allow_cross_tenant_replication=None, default_share_permission=None,
enable_nfs_v3=None, subnet=None, vnet_name=None, action='Allow', enable_alw=None,
immutability_period_since_creation_in_days=None, immutability_policy_state=None,
allow_protected_append_writes=None, public_network_access=None, allowed_copy_scope=None):
allow_protected_append_writes=None, public_network_access=None, allowed_copy_scope=None,
dns_endpoint_type=None):
StorageAccountCreateParameters, Kind, Sku, CustomDomain, AccessTier, Identity, Encryption, NetworkRuleSet = \
cmd.get_models('StorageAccountCreateParameters', 'Kind', 'Sku', 'CustomDomain', 'AccessTier', 'Identity',
'Encryption', 'NetworkRuleSet')
Expand Down Expand Up @@ -221,6 +222,9 @@ def create_storage_account(cmd, resource_group_name, account_name, sku=None, loc
if allowed_copy_scope is not None:
params.allowed_copy_scope = allowed_copy_scope

if dns_endpoint_type is not None:
params.dns_endpoint_type = dns_endpoint_type

return scf.storage_accounts.begin_create(resource_group_name, account_name, params)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
from azure.cli.core.profiles import register_resource_type
from ...profiles import CUSTOM_MGMT_STORAGE, CUSTOM_DATA_STORAGE_FILEDATALAKE

register_resource_type('latest', CUSTOM_MGMT_STORAGE, '2021-08-01')
register_resource_type('latest', CUSTOM_MGMT_STORAGE, '2021-09-01')
register_resource_type('latest', CUSTOM_DATA_STORAGE_FILEDATALAKE, '2020-06-12')
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
interactions:
- request:
body: '{"sku": {"name": "Standard_RAGRS"}, "kind": "StorageV2", "location": "eastus2euap",
"properties": {"encryption": {"services": {"blob": {}}, "keySource": "Microsoft.Storage"},
"isHnsEnabled": true, "dnsEndpointType": "Standard"}}'
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
CommandName:
- storage account create
Connection:
- keep-alive
Content-Length:
- '228'
Content-Type:
- application/json
ParameterSetName:
- -n -g -l --hns --dns-endpoint-type
User-Agent:
- AZURECLI/2.35.0 azsdk-python-azure-mgmt-storage/20.0.0 Python/3.7.9 (Windows-10-10.0.22000-SP0)
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_storage_account_dns_et000001/providers/Microsoft.Storage/storageAccounts/cli000002?api-version=2021-09-01
response:
body:
string: ''
headers:
cache-control:
- no-cache
content-length:
- '0'
content-type:
- text/plain; charset=utf-8
date:
- Mon, 11 Apr 2022 07:13:07 GMT
expires:
- '-1'
location:
- https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/locations/eastus2euap/asyncoperations/3f0db60e-e023-4002-948a-636adcc9c2bb?monitor=true&api-version=2021-09-01
pragma:
- no-cache
server:
- Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0
strict-transport-security:
- max-age=31536000; includeSubDomains
x-content-type-options:
- nosniff
x-ms-ratelimit-remaining-subscription-writes:
- '1198'
status:
code: 202
message: Accepted
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
CommandName:
- storage account create
Connection:
- keep-alive
ParameterSetName:
- -n -g -l --hns --dns-endpoint-type
User-Agent:
- AZURECLI/2.35.0 azsdk-python-azure-mgmt-storage/20.0.0 Python/3.7.9 (Windows-10-10.0.22000-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/locations/eastus2euap/asyncoperations/3f0db60e-e023-4002-948a-636adcc9c2bb?monitor=true&api-version=2021-09-01
response:
body:
string: '{"sku":{"name":"Standard_RAGRS","tier":"Standard"},"kind":"StorageV2","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_storage_account_dns_et000001/providers/Microsoft.Storage/storageAccounts/cli000002","name":"cli000002","type":"Microsoft.Storage/storageAccounts","location":"eastus2euap","tags":{},"properties":{"dnsEndpointType":"Standard","keyCreationTime":{"key1":"2022-04-11T07:13:04.8199696Z","key2":"2022-04-11T07:13:04.8199696Z"},"privateEndpointConnections":[],"minimumTlsVersion":"TLS1_0","allowBlobPublicAccess":true,"isHnsEnabled":true,"networkAcls":{"bypass":"AzureServices","virtualNetworkRules":[],"ipRules":[],"defaultAction":"Allow"},"supportsHttpsTrafficOnly":true,"encryption":{"services":{"file":{"keyType":"Account","enabled":true,"lastEnabledTime":"2022-04-11T07:13:04.8355888Z"},"blob":{"keyType":"Account","enabled":true,"lastEnabledTime":"2022-04-11T07:13:04.8355888Z"}},"keySource":"Microsoft.Storage"},"accessTier":"Hot","provisioningState":"Succeeded","creationTime":"2022-04-11T07:13:04.7262191Z","primaryEndpoints":{"dfs":"https://cli000002.dfs.core.windows.net/","web":"https://cli000002.z3.web.core.windows.net/","blob":"https://cli000002.blob.core.windows.net/","queue":"https://cli000002.queue.core.windows.net/","table":"https://cli000002.table.core.windows.net/","file":"https://cli000002.file.core.windows.net/"},"primaryLocation":"eastus2euap","statusOfPrimary":"available","secondaryLocation":"centraluseuap","statusOfSecondary":"available","secondaryEndpoints":{"dfs":"https://cli000002-secondary.dfs.core.windows.net/","web":"https://cli000002-secondary.z3.web.core.windows.net/","blob":"https://cli000002-secondary.blob.core.windows.net/","queue":"https://cli000002-secondary.queue.core.windows.net/","table":"https://cli000002-secondary.table.core.windows.net/"}}}'
headers:
cache-control:
- no-cache
content-length:
- '1841'
content-type:
- application/json
date:
- Mon, 11 Apr 2022 07:13:24 GMT
expires:
- '-1'
pragma:
- no-cache
server:
- Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
status:
code: 200
message: OK
- request:
body: '{"sku": {"name": "Standard_RAGRS"}, "kind": "StorageV2", "location": "eastus2euap",
"properties": {"encryption": {"services": {"blob": {}}, "keySource": "Microsoft.Storage"},
"isHnsEnabled": true, "dnsEndpointType": "AzureDnsZone"}}'
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
CommandName:
- storage account create
Connection:
- keep-alive
Content-Length:
- '232'
Content-Type:
- application/json
ParameterSetName:
- -n -g -l --hns --dns-endpoint-type
User-Agent:
- AZURECLI/2.35.0 azsdk-python-azure-mgmt-storage/20.0.0 Python/3.7.9 (Windows-10-10.0.22000-SP0)
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_storage_account_dns_et000001/providers/Microsoft.Storage/storageAccounts/cli000003?api-version=2021-09-01
response:
body:
string: ''
headers:
cache-control:
- no-cache
content-length:
- '0'
content-type:
- text/plain; charset=utf-8
date:
- Mon, 11 Apr 2022 07:13:29 GMT
expires:
- '-1'
location:
- https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/locations/eastus2euap/asyncoperations/e03b31c9-e6ab-43a5-98e3-2ed788bce971?monitor=true&api-version=2021-09-01
pragma:
- no-cache
server:
- Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0
strict-transport-security:
- max-age=31536000; includeSubDomains
x-content-type-options:
- nosniff
x-ms-ratelimit-remaining-subscription-writes:
- '1197'
status:
code: 202
message: Accepted
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
CommandName:
- storage account create
Connection:
- keep-alive
ParameterSetName:
- -n -g -l --hns --dns-endpoint-type
User-Agent:
- AZURECLI/2.35.0 azsdk-python-azure-mgmt-storage/20.0.0 Python/3.7.9 (Windows-10-10.0.22000-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/locations/eastus2euap/asyncoperations/e03b31c9-e6ab-43a5-98e3-2ed788bce971?monitor=true&api-version=2021-09-01
response:
body:
string: ''
headers:
cache-control:
- no-cache
content-length:
- '0'
content-type:
- text/plain; charset=utf-8
date:
- Mon, 11 Apr 2022 07:13:46 GMT
expires:
- '-1'
location:
- https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/locations/eastus2euap/asyncoperations/e03b31c9-e6ab-43a5-98e3-2ed788bce971?monitor=true&api-version=2021-09-01
pragma:
- no-cache
server:
- Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0
strict-transport-security:
- max-age=31536000; includeSubDomains
x-content-type-options:
- nosniff
status:
code: 202
message: Accepted
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
CommandName:
- storage account create
Connection:
- keep-alive
ParameterSetName:
- -n -g -l --hns --dns-endpoint-type
User-Agent:
- AZURECLI/2.35.0 azsdk-python-azure-mgmt-storage/20.0.0 Python/3.7.9 (Windows-10-10.0.22000-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Storage/locations/eastus2euap/asyncoperations/e03b31c9-e6ab-43a5-98e3-2ed788bce971?monitor=true&api-version=2021-09-01
response:
body:
string: '{"sku":{"name":"Standard_RAGRS","tier":"Standard"},"kind":"StorageV2","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_storage_account_dns_et000001/providers/Microsoft.Storage/storageAccounts/cli000003","name":"cli000003","type":"Microsoft.Storage/storageAccounts","location":"eastus2euap","tags":{},"properties":{"dnsEndpointType":"AzureDnsZone","keyCreationTime":{"key1":"2022-04-11T07:13:27.6637766Z","key2":"2022-04-11T07:13:27.6637766Z"},"privateEndpointConnections":[],"minimumTlsVersion":"TLS1_0","allowBlobPublicAccess":true,"isHnsEnabled":true,"networkAcls":{"bypass":"AzureServices","virtualNetworkRules":[],"ipRules":[],"defaultAction":"Allow"},"supportsHttpsTrafficOnly":true,"encryption":{"services":{"file":{"keyType":"Account","enabled":true,"lastEnabledTime":"2022-04-11T07:13:27.6637766Z"},"blob":{"keyType":"Account","enabled":true,"lastEnabledTime":"2022-04-11T07:13:27.6637766Z"}},"keySource":"Microsoft.Storage"},"accessTier":"Hot","provisioningState":"Succeeded","creationTime":"2022-04-11T07:13:27.5544019Z","primaryEndpoints":{"dfs":"https://cli000003.z29.dfs.storage.azure.net/","web":"https://cli000003.z29.web.storage.azure.net/","blob":"https://cli000003.z29.blob.storage.azure.net/","queue":"https://cli000003.z29.queue.storage.azure.net/","table":"https://cli000003.z29.table.storage.azure.net/","file":"https://cli000003.z29.file.storage.azure.net/"},"primaryLocation":"eastus2euap","statusOfPrimary":"available","secondaryLocation":"centraluseuap","statusOfSecondary":"available","secondaryEndpoints":{"dfs":"https://cli000003-secondary.z29.dfs.storage.azure.net/","web":"https://cli000003-secondary.z29.web.storage.azure.net/","blob":"https://cli000003-secondary.z29.blob.storage.azure.net/","queue":"https://cli000003-secondary.z29.queue.storage.azure.net/","table":"https://cli000003-secondary.z29.table.storage.azure.net/"}}}'
headers:
cache-control:
- no-cache
content-length:
- '1894'
content-type:
- application/json
date:
- Mon, 11 Apr 2022 07:13:49 GMT
expires:
- '-1'
pragma:
- no-cache
server:
- Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
status:
code: 200
message: OK
version: 1
Loading

0 comments on commit 4dbb0b7

Please sign in to comment.