VM create failed with is osDisk Fehler: msrestazure.azure_exceptions.CloudError: Die Eigenschaft 'osDisk.image.uri' ist nicht erlaubt.Azure python vm create schlägt fehl beim Versuch, ein Image mit benutzerdefiniertem Image zu erstellen
-Code-Schnipsel ist wie folgt:
storage_profile=azure.mgmt.compute.models.StorageProfile(
os_disk=azure.mgmt.compute.models.OSDisk(
caching=azure.mgmt.compute.models.CachingTypes.none,
create_option=azure.mgmt.compute.models.DiskCreateOptionTypes.from_image,
name=OS_DISK_NAME,
os_type='Linux',
vhd=azure.mgmt.compute.models.VirtualHardDisk(
uri='https://{0}.blob.core.windows.net/vhds/{1}.vhd'.format(
STORAGE_NAME,
OS_DISK_NAME,
),
),
image=azure.mgmt.compute.models.VirtualHardDisk(
uri='https://xxxxxxxxx.blob.core.windows.net/vm-images/Centos67-Azure.vhd'
),
)
Bild wird in der Python-API definiert und die URi arbeitet definiert fein mit dem Azure CLI
API azur == 2.0.0rc3
Wenn Es hilft, dass die Transaktion an azur gesendet wird:
url: hps: //management.azure.com/subscriptions/b 97ddb69-f825-48b4-9e19-48eb3b4c8267/resourceGroups/dev-eu-vnet9-rg/Anbieter/Microsoft.Compute/Virtualmachines/centos67-api
Kopfparameter: { 'accept-language': ‚en- US ',' Inhaltstyp ':' application/json; charset = UTF-8' , 'X-MS-client-request-id': 'f65196f4-0e3b-11e6-A61B-b499baffc71a'}
Körpergehalt: { 'Eigenschaften': { 'storageProfile': {'osDisk': {'osType': 'Linux', 'createOption': 'fromImage', 'Name': 'centos67-api', 'caching': 'Keine', 'vhd': {'uri': ' https://deveuvnet9rg9944.blob.core.windows.net/vhds/centos67-api.vhd '},' image ': {' uri ':' https://deveuvnet9rg9944.blob.core.windows.net/vm-images/Centos67-Azure.vhd '}}},' Hardwareprofil ': {' vmSize ':' Standard_DS1 '},' osProfile ': {' adminUsername ':' cloud_user ',' Computername ' : 'centos67-api', 'adminPassword': 'xxxxxxxx'}, 'Netzwerkprofil': {'networkInterfaces': [{'id': '/ subscriptions/b97ddb69-f825-48b4-9e19-48eb3b4c8267/resourceGroups/dev-eu -vnet9-rg/providers/Microsoft.Network/networkInterfaces/centos67-api '}]}},' location ':' eastus '}
Traceback (letzter Aufruf zuletzt): Datei "./azure_client.py", Zeile 220, in result.wait() # asynchrone Operation Datei "/usr/lib/python2.7/site-packages/msrestazure/ azure_operation.py ", Zeile 639, in Warteposition raise self._exception msrestazure.azure_exceptions.CloudError: Ändern der Eigenschaft 'osDisk.image.uri' ist nicht zulässig.
aus der Klassendefinition für OSDisk: –
Entsprechend dem Dokument für REST API [Erstellen oder Aktualisieren einer virtuellen Maschine] (https://msdn.microsoft.com/en-us/library/azure/mt163591.aspx), Der Inhalt des Anfragetext enthält nicht die Eigenschaft 'image' der' osDisk' für das 'storageProfile'. –