0

CLI を使用して同じサブスクリプション内のストレージ アカウントで VHD ファイルからマネージド ディスクを作成するときに問題が発生します。

以下のスクリプトを使用して、ウェストス リージョンからイーストス リージョンにマネージド ディスク増分スナップショットをレプリケート/コピーしました。


#Provide the name of your resource group where snapshot is created
sourceResourceGroupName=""
drSnapshotResourceGroupName=""

#Provide storage account name where you want to copy the snapshot.
drSnapshotStorageAccountName=""

#Name of the storage container where the downloaded snapshot will be stored
storageContainerName=""

#Provide Shared Access Signature (SAS) expiry duration in seconds e.g. 3600.
#Know more about SAS here: https://docs.microsoft.com/en-us/azure/storage/storage-dotnet-shared-access-signature-part-1
sasExpiryDuration=36000

#Provide the key of the storage account where you want to copy snapshot.
storageAccountKey=$(az storage account keys list -g $drSnapshotResourceGroupName -n $drSnapshotStorageAccountName --query [0].value -otsv)

SNAPSHOT_NAMES=$(az snapshot list -g $sourceResourceGroupName --query "[?tags.COMPONENT== 'database'].name" --output tsv)

for snapshot_name in $SNAPSHOT_NAMES
do
        #Provide the snapshot name
        snapshotName=$snapshot_name

        #Provide the name of the VHD file to which snapshot will be copied.
        destinationVHDFileName="$snapshot_name.vhd"

     
        sas=$(az snapshot grant-access --resource-group $sourceResourceGroupName --name $snapshotName \
                --duration-in-seconds $sasExpiryDuration --query [accessSas] -o tsv)

        az storage blob incremental-copy start --destination-blob $destinationVHDFileName \
        --destination-container $storageContainerName --account-name $drSnapshotStorageAccountName \
        --account-key $storageAccountKey --source-uri $sas
done

以下のスクリプトを使用して az cli を使用して、eastus リージョンにコピーされた vhd からマネージド ディスクを作成しようとしています。

#Provide the name of your resource group where snapshot is created
drSnapshotResourceGroupName=""

#Provide the name of your resource group.
#Ensure that resource group is already created
drResourceGroupName=""

#Provide storage account name where you want to copy the snapshot.
drSnapshotStorageAccountName=""

#Name of the storage container where the downloaded snapshot will be stored
storageContainerName=""

#Provide the name of the Managed Disk
diskName=disknametocreatefromvhd

#Provide the size of the disks in GB. It should be greater than the VHD file size.
diskSize=512


#Provide the URI of the VHD file that will be used to create Managed Disk.
# VHD file can be deleted as soon as Managed Disk is created.
# e.g. https://contosostorageaccount1.blob.core.windows.net/vhds/contosovhd123.vhd
vhdUri=https://xxxxxxxxxxxxxxxxxx.blob.core.windows.net/asdf/abcd.vhd

#Provide the storage type for the Managed Disk. Premium_LRS or Standard_LRS.
storageType=Premium_LRS

#Provide the Azure location (e.g. westus) where Managed Disk will be located.
location=eastus

echo "Creating managed disk from the VHD file"

#Create the Managed disk from the VHD file
az disk create --resource-group ${drResourceGroupName} --name ${diskName} \
                --sku $storageType --location $location \
                --size-gb $diskSize --source $vhdUri

以下の z disk create のエラーを取得します。

request failed: Error occurred in request., RetryError: HTTPSConnectionPool(host='management.azure.com', port=443): Max retries exceeded with url: /subscriptions/32d45ca1-b2dc-4370-a618-85e7756da78f/resourceGroups/DR02-Recovery/providers/Microsoft.Compute/disks/draas-snapshot-database-vm0-osdisk-asdf?api-version=2019-11-01 (Caused by ResponseError('too many 500 error responses',))

ここに完全なデバッグ出力を追加します。

Command arguments: ['disk', 'create', '--resource-group', 'RG_NAME', '--name', 'abcd-osdisk', '--sku', 'Premium_LRS', '--location', 'eastus', '--size-gb', '512', '--source', 'https://storageaccountname.blob.core.windows.net/asdf/abcd-osdisk.vhd', '--debug']
Event: Cli.PreExecute []
Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7fa05b4d5d90>, <function OutputProducer.on_global_arguments at 0x7fa05b2aad90>, <function CLIQuery.on_global_arguments at 0x7fa05b052048>]
Event: CommandInvoker.OnPreCommandTableCreate []
Installed command modules ['acr', 'acs', 'advisor', 'ams', 'apim', 'appconfig', 'appservice', 'aro', 'backup', 'batch', 'batchai', 'billing', 'botservice', 'cdn', 'cloud', 'cognitiveservices', 'configure', 'consumption', 'container', 'cosmosdb', 'deploymentmanager', 'dla', 'dls', 'dms', 'eventgrid', 'eventhubs', 'extension', 'feedback', 'find', 'hdinsight', 'interactive', 'iot', 'iotcentral', 'keyvault', 'kusto', 'lab', 'managedservices', 'maps', 'monitor', 'natgateway', 'netappfiles', 'network', 'policyinsights', 'privatedns', 'profile', 'rdbms', 'redis', 'relay', 'reservations', 'resource', 'role', 'search', 'security', 'servicebus', 'servicefabric', 'signalr', 'sql', 'sqlvm', 'storage', 'util', 'vm']
Loaded module 'acr' in 0.007 seconds.
Loaded module 'acs' in 0.008 seconds.
Loaded module 'advisor' in 0.001 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'ams' in 0.006 seconds.
Loaded module 'apim' in 0.002 seconds.
Loaded module 'appconfig' in 0.003 seconds.
Loaded module 'appservice' in 0.223 seconds.
Loaded module 'aro' in 0.005 seconds.
Loaded module 'backup' in 0.004 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'batch' in 0.028 seconds.
Loaded module 'batchai' in 0.003 seconds.
Loaded module 'billing' in 0.001 seconds.
Loaded module 'botservice' in 0.003 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'cdn' in 0.005 seconds.
Loaded module 'cloud' in 0.001 seconds.
Loaded module 'cognitiveservices' in 0.002 seconds.
Loaded module 'configure' in 0.001 seconds.
Loaded module 'consumption' in 0.002 seconds.
Loaded module 'container' in 0.002 seconds.
Loaded module 'cosmosdb' in 0.008 seconds.
Loaded module 'deploymentmanager' in 0.002 seconds.
Loaded module 'dla' in 0.004 seconds.
Loaded module 'dls' in 0.003 seconds.
Loaded module 'dms' in 0.002 seconds.
Loaded module 'eventgrid' in 0.002 seconds.
Loaded module 'eventhubs' in 0.004 seconds.
Loaded module 'extension' in 0.001 seconds.
Loaded module 'feedback' in 0.001 seconds.
Loaded module 'find' in 0.001 seconds.
Loaded module 'hdinsight' in 0.002 seconds.
Loaded module 'interactive' in 0.000 seconds.
Loaded module 'iot' in 0.005 seconds.
Loaded module 'iotcentral' in 0.001 seconds.
Loaded module 'keyvault' in 0.006 seconds.
Loaded module 'kusto' in 0.002 seconds.
Loaded module 'lab' in 0.003 seconds.
Loaded module 'managedservices' in 0.002 seconds.
Loaded module 'maps' in 0.001 seconds.
Loaded module 'monitor' in 0.009 seconds.
Loaded module 'natgateway' in 0.001 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'netappfiles' in 0.003 seconds.
Loaded module 'network' in 0.035 seconds.
Loaded module 'policyinsights' in 0.003 seconds.
Loaded module 'privatedns' in 0.005 seconds.
Loaded module 'profile' in 0.001 seconds.
Loaded module 'rdbms' in 0.008 seconds.
Loaded module 'redis' in 0.002 seconds.
Loaded module 'relay' in 0.003 seconds.
Loaded module 'reservations' in 0.002 seconds.
Loaded module 'resource' in 0.011 seconds.
Loaded module 'role' in 0.004 seconds.
Loaded module 'search' in 0.001 seconds.
Loaded module 'security' in 0.004 seconds.
Loaded module 'servicebus' in 0.005 seconds.
Loaded module 'servicefabric' in 0.003 seconds.
Loaded module 'signalr' in 0.002 seconds.
Loaded module 'sql' in 0.011 seconds.
Loaded module 'sqlvm' in 0.002 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'storage' in 0.042 seconds.
Loaded module 'util' in 0.001 seconds.
Loaded module 'vm' in 0.042 seconds.
Loaded all modules in 0.560 seconds. (note: there's always an overhead with the first module loaded)
Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7fa05aa09950>]
az_command_data_logger : command args: disk create --resource-group {} --name {} --sku {} --location {} --size-gb {} --source {} --debug
metadata file logging enabled - writing logs to '/home/Test/.azure/commands'.
Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x7fa05aa2cae8>]
Event: CommandInvoker.OnPostArgumentLoad []
Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x7fa05a9e1bf8>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x7fa05a9e1d08>]
Event: CommandInvoker.OnCommandTableLoaded []
Event: CommandInvoker.OnPreParseArgs [<function _documentdb_deprecate at 0x7fa05898b1e0>]
Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7fa05b2aae18>, <function CLIQuery.handle_query_parameter at 0x7fa05b0520d0>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x7fa05a9e1c80>, <function handler at 0x7fa0587e6bf8>]
Getting management service client client_type=ComputeManagementClient
msrest.universal_http.requests : Configuring retry: max_retries=4, backoff_factor=0.8, max_backoff=90
urllib3.connectionpool : Starting new HTTP connection (1): localhost:50342
urllib3.connectionpool : http://localhost:50342 "POST /oauth2/token HTTP/1.1" 200 2054
msrestazure.azure_active_directory : MSI: Retrieving a token from http://localhost:50342/oauth2/token, with payload {'resource': 'https://management.core.windows.net/'}
urllib3.connectionpool : Starting new HTTP connection (1): localhost:50342
urllib3.connectionpool : http://localhost:50342 "POST /oauth2/token HTTP/1.1" 200 2054
msrestazure.azure_active_directory : MSI: Retrieving a token from http://localhost:50342/oauth2/token, with payload {'resource': 'https://management.core.windows.net/'}
msrest.http_logger : Request URL: 'https://management.azure.com/subscriptions/32d45ba1-b2dc-4370-a618-85e7756da78f/resourceGroups/RG_NAME/providers/Microsoft.Compute/disks/abcd-osdisk?api-version=2019-11-01'
msrest.http_logger : Request method: 'PUT'
msrest.http_logger : Request headers:
msrest.http_logger :     'Accept': 'application/json'
msrest.http_logger :     'Content-Type': 'application/json; charset=utf-8'
msrest.http_logger :     'accept-language': 'en-US'
msrest.http_logger :     'Content-Length': '461'
msrest.http_logger :     'User-Agent': 'python/3.6.10 (Linux-4.15.0-1089-azure-x86_64-with-debian-stretch-sid) msrest/0.6.9 cloud-shell/1.0 msrest_azure/0.6.3 azure-mgmt-compute/12.0.0 Azure-SDK-For-Python AZURECLI/2.8.0 (DEB)'
msrest.http_logger : Request body:
msrest.http_logger : {"location": "eastus", "tags": {}, "sku": {"name": "Premium_LRS"}, "properties": {"hyperVGeneration": "V1", "creationData": {"createOption": "Import", "storageAccountId": "/subscriptions/32d45ba1-b2dc-4370-a618-85e7756da78f/resourceGroups/RG_NAME/providers/Microsoft.Storage/storageAccounts/storageaccountname", "sourceUri": "https://storageaccountname.blob.core.windows.net/asdf/abcd-osdisk.vhd"}, "diskSizeGB": 512}}
msrest.universal_http : Configuring redirects: allow=True, max=30
msrest.universal_http : Configuring request: timeout=100, verify=True, cert=None
msrest.universal_http : Configuring proxies: ''
msrest.universal_http : Evaluate proxies against ENV settings: True
urllib3.connectionpool : Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool : https://management.azure.com:443 "PUT /subscriptions/32d45ba1-b2dc-4370-a618-85e7756da78f/resourceGroups/RG_NAME/providers/Microsoft.Compute/disks/abcd-osdisk?api-version=2019-11-01 HTTP/1.1" 500 125
urllib3.util.retry : Incremented Retry for (url='/subscriptions/32d45ba1-b2dc-4370-a618-85e7756da78f/resourceGroups/RG_NAME/providers/Microsoft.Compute/disks/abcd-osdisk?api-version=2019-11-01'): Retry(total=3, connect=4, read=4, redirect=None, status=None)
urllib3.connectionpool : Retry: /subscriptions/32d45ba1-b2dc-4370-a618-85e7756da78f/resourceGroups/RG_NAME/providers/Microsoft.Compute/disks/abcd-osdisk?api-version=2019-11-01
urllib3.connectionpool : Resetting dropped connection: management.azure.com
urllib3.connectionpool : https://management.azure.com:443 "PUT /subscriptions/32d45ba1-b2dc-4370-a618-85e7756da78f/resourceGroups/RG_NAME/providers/Microsoft.Compute/disks/abcd-osdisk?api-version=2019-11-01 HTTP/1.1" 500 125
urllib3.util.retry : Incremented Retry for (url='/subscriptions/32d45ba1-b2dc-4370-a618-85e7756da78f/resourceGroups/RG_NAME/providers/Microsoft.Compute/disks/abcd-osdisk?api-version=2019-11-01'): Retry(total=2, connect=4, read=4, redirect=None, status=None)

urllib3.connectionpool : Retry: /subscriptions/32d45ba1-b2dc-4370-a618-85e7756da78f/resourceGroups/RG_NAME/providers/Microsoft.Compute/disks/abcd-osdisk?api-version=2019-11-01
urllib3.connectionpool : Resetting dropped connection: management.azure.com
urllib3.connectionpool : https://management.azure.com:443 "PUT /subscriptions/32d45ba1-b2dc-4370-a618-85e7756da78f/resourceGroups/RG_NAME/providers/Microsoft.Compute/disks/abcd-osdisk?api-version=2019-11-01 HTTP/1.1" 500 125
urllib3.util.retry : Incremented Retry for (url='/subscriptions/32d45ba1-b2dc-4370-a618-85e7756da78f/resourceGroups/RG_NAME/providers/Microsoft.Compute/disks/abcd-osdisk?api-version=2019-11-01'): Retry(total=1, connect=4, read=4, redirect=None, status=None)

urllib3.connectionpool : Retry: /subscriptions/32d45ba1-b2dc-4370-a618-85e7756da78f/resourceGroups/RG_NAME/providers/Microsoft.Compute/disks/abcd-osdisk?api-version=2019-11-01
urllib3.connectionpool : Resetting dropped connection: management.azure.com
urllib3.connectionpool : https://management.azure.com:443 "PUT /subscriptions/32d45ba1-b2dc-4370-a618-85e7756da78f/resourceGroups/RG_NAME/providers/Microsoft.Compute/disks/abcd-osdisk?api-version=2019-11-01 HTTP/1.1" 500 125
urllib3.util.retry : Incremented Retry for (url='/subscriptions/32d45ba1-b2dc-4370-a618-85e7756da78f/resourceGroups/RG_NAME/providers/Microsoft.Compute/disks/abcd-osdisk?api-version=2019-11-01'): Retry(total=0, connect=4, read=4, redirect=None, status=None)


urllib3.connectionpool : Retry: /subscriptions/32d45ba1-b2dc-4370-a618-85e7756da78f/resourceGroups/RG_NAME/providers/Microsoft.Compute/disks/abcd-osdisk?api-version=2019-11-01
urllib3.connectionpool : Resetting dropped connection: management.azure.com
urllib3.connectionpool : https://management.azure.com:443 "PUT /subscriptions/32d45ba1-b2dc-4370-a618-85e7756da78f/resourceGroups/RG_NAME/providers/Microsoft.Compute/disks/abcd-osdisk?api-version=2019-11-01 HTTP/1.1" 500 125
msrest.exceptions : Error occurred in request., RetryError: HTTPSConnectionPool(host='management.azure.com', port=443): Max retries exceeded with url: /subscriptions/32d45ba1-b2dc-4370-a618-85e7756da78f/resourceGroups/RG_NAME/providers/Microsoft.Compute/disks/abcd-osdisk?api-version=2019-11-01 (Caused by ResponseError('too many 500 error responses',))


cli.azure.cli.core.util : request failed: Error occurred in request., RetryError: HTTPSConnectionPool(host='management.azure.com', port=443): Max retries exceeded with url: /subscriptions/32d45ba1-b2dc-4370-a618-85e7756da78f/resourceGroups/RG_NAME/providers/Microsoft.Compute/disks/abcd-osdisk?api-version=2019-11-01 (Caused by ResponseError('too many 500 error responses',))
request failed: Error occurred in request., RetryError: HTTPSConnectionPool(host='management.azure.com', port=443): Max retries exceeded with url: /subscriptions/32d45ba1-b2dc-4370-a618-85e7756da78f/resourceGroups/RG_NAME/providers/Microsoft.Compute/disks/abcd-osdisk?api-version=2019-11-01 (Caused by ResponseError('too many 500 error responses',))
Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7fa05aa09b70>]
az_command_data_logger : exit code: 1
telemetry.save : Save telemetry record of length 5618 in cache
telemetry.check : Returns Positive.
telemetry.main : Begin creating telemetry upload process.
telemetry.process : Creating upload process: "/opt/az/bin/python3 /opt/az/lib/python3.6/site-packages/azure/cli/telemetry/__init__.py /home/vinayak/.azure"
telemetry.process : Return from creating process
telemetry.main : Finish creating telemetry upload process.
Command ran in 725.683 seconds (init: 0.048, invoke: 725.635)

4

1 に答える 1