When creating a Virtual Machine in Azure using the REST API[1], the value of the name
property under networkInterfaceConfigurations
is used as a prefix and not the absolute name. Here's a request and the response to it as logged by the Azure Java SDK:
Feb 09, 2024 11:40:14 AM com.azure.core.util.logging.LoggingEventBuilder performLogging
INFO: {"az.sdk.message":"HTTP request","method":"PUT","url":"https://management.azure.com/subscriptions/REDACTED/resourceGroups/dev.eastus-az1-tenant/providers/Microsoft.Compute/virtualMachines/h11-dev-eastus-az1?api-version=2023-09-01","tryCount":1,"Date":"Fri, 09 Feb 2024 10:40:13 GMT","Content-Length":"2382","x-ms-return-client-request-id":"true","Content-Type":"application/json","x-ms-client-request-id":"6f50ccbc-a3bb-4160-b6a0-48c8920bb40d","Accept":"application/json","User-Agent":"azsdk-java-com.azure.resourcemanager.compute/2.35.0 (17.0.3; Linux; 5.15.0-89-generic)","redactedHeaders":"Authorization","contentLength":2382,"body":"{\"location\":\"eastus\",\"properties\":{\"hardwareProfile\":{\"vmSize\":\"Standard_B1ms\"},\"storageProfile\":{\"imageReference\":{\"id\":\"/subscriptions/REDACTED/resourceGroups/vm-images/providers/Microsoft.Compute/galleries/vespa_almalinux_8/images/x86_64/versions/latest\"},\"osDisk\":{\"name\":\"h11-dev-eastus-az1-disk-root\",\"createOption\":\"FromImage\",\"diskSizeGB\":30,\"managedDisk\":{\"diskEncryptionSet\":{\"id\":\"/subscriptions/REDACTED/resourceGroups/dev.eastus-az1/providers/Microsoft.Compute/diskEncryptionSets/disk-encryption\"}},\"deleteOption\":\"Delete\"},\"dataDisks\":[{\"lun\":0,\"name\":\"h11-dev-eastus-az1-disk-data\",\"createOption\":\"Empty\",\"diskSizeGB\":100,\"deleteOption\":\"Delete\"}]},\"osProfile\":{\"computerName\":\"h11-dev-eastus-az1\",\"adminUsername\":\"vespa\",\"adminPassword\":\"bdNqXLkT40ZmjR8p-VmsgoiWCPqL2AaGdEsDfttejkLvTI09EDLuk8OgzKcu1diFFSBIsw\",\"linuxConfiguration\":{}},\"networkProfile\":{\"networkApiVersion\":\"2020-11-01\",\"networkInterfaceConfigurations\":[{\"name\":\"h11-dev-eastus-az1-nic\",\"properties\":{\"deleteOption\":\"Delete\",\"ipConfigurations\":[{\"name\":\"h11-dev-eastus-az1-ip4c-0\",\"properties\":{\"subnet\":{\"id\":\"/subscriptions/REDACTED/resourceGroups/dev.eastus-az1/providers/Microsoft.Network/virtualNetworks/network/subnets/subnet-tenant\"},\"primary\":true,\"publicIPAddressConfiguration\":{\"name\":\"h11-dev-eastus-az1-pip4-0\",\"properties\":{\"publicIPAddressVersion\":\"IPv4\",\"publicIPAllocationMethod\":\"Static\"},\"sku\":{\"name\":\"Standard\"}},\"privateIPAddressVersion\":\"IPv4\"}},{\"name\":\"h11-dev-eastus-az1-ip4c-1\",\"properties\":{\"subnet\":{\"id\":\"/subscriptions/REDACTED/resourceGroups/dev.eastus-az1/providers/Microsoft.Network/virtualNetworks/network/subnets/subnet-tenant\"},\"primary\":false,\"publicIPAddressConfiguration\":{\"name\":\"h11-dev-eastus-az1-pip4-1\",\"properties\":{\"publicIPAddressVersion\":\"IPv4\",\"publicIPAllocationMethod\":\"Static\"},\"sku\":{\"name\":\"Standard\"}},\"privateIPAddressVersion\":\"IPv4\"}}]}}]},\"securityProfile\":{\"encryptionAtHost\":true},\"userData\":\"IyEvYmluL3NoCmVjaG8gIlByb3Zpc2lvbmVkIGZyb20gQXp1cmVDb21wdXRlQ2xpZW50VGVzdCIgfCB0ZWUgL3Jvb3Qvb3V0cHV0LnR4dAo=\"},\"identity\":{\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"/subscriptions/REDACTED/resourceGroups/system/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id-tenant\":{}}},\"zones\":[\"3\"]}"}
Feb 09, 2024 11:40:18 AM com.azure.core.util.logging.LoggingEventBuilder performLogging
INFO: {"az.sdk.message":"HTTP response","contentLength":"2894","statusCode":201,"url":"https://management.azure.com/subscriptions/REDACTED/resourceGroups/dev.eastus-az1-tenant/providers/Microsoft.Compute/virtualMachines/h11-dev-eastus-az1?api-version=2023-09-01","durationMs":3790,"Date":"Fri, 09 Feb 2024 10:40:17 GMT","Server":"Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0","Content-Length":"2894","Expires":"-1","Retry-After":"10","Pragma":"no-cache","Content-Type":"application/json; charset=utf-8","Cache-Control":"no-cache","x-ms-request-id":"091d061e-63dd-4e0f-a11a-b7c11104098e","x-ms-client-request-id":"6f50ccbc-a3bb-4160-b6a0-48c8920bb40d","redactedHeaders":"azure-asyncnotification,x-ms-ratelimit-remaining-subscription-writes,x-ms-correlation-request-id,Strict-Transport-Security,X-Content-Type-Options,x-ms-routing-request-id,x-ms-ratelimit-remaining-resource,Azure-AsyncOperation","body":"{\r\n \"name\": \"h11-dev-eastus-az1\",\r\n \"id\": \"/subscriptions/REDACTED/resourceGroups/dev.eastus-az1-tenant/providers/Microsoft.Compute/virtualMachines/h11-dev-eastus-az1\",\r\n \"type\": \"Microsoft.Compute/virtualMachines\",\r\n \"location\": \"eastus\",\r\n \"identity\": {\r\n \"type\": \"UserAssigned\",\r\n \"userAssignedIdentities\": {\r\n \"/subscriptions/REDACTED/resourceGroups/system/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id-tenant\": {}\r\n }\r\n },\r\n \"properties\": {\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_B1ms\"\r\n },\r\n \"provisioningState\": \"Creating\",\r\n \"vmId\": \"6efca292-4b7a-4e9b-b0c6-ac87c8ad0d69\",\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \"id\": \"/subscriptions/REDACTED/resourceGroups/vm-images/providers/Microsoft.Compute/galleries/vespa_almalinux_8/images/x86_64/versions/latest\",\r\n \"exactVersion\": \"8.20240208.142019\"\r\n },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \"name\": \"h11-dev-eastus-az1-disk-root\",\r\n \"createOption\": \"FromImage\",\r\n \"caching\": \"ReadWrite\",\r\n \"managedDisk\": {\r\n \"diskEncryptionSet\": {\r\n \"id\": \"/subscriptions/REDACTED/resourceGroups/dev.eastus-az1/providers/Microsoft.Compute/diskEncryptionSets/disk-encryption\"\r\n },\r\n \"storageAccountType\": \"Premium_LRS\"\r\n },\r\n \"deleteOption\": \"Delete\",\r\n \"diskSizeGB\": 30\r\n },\r\n \"dataDisks\": [\r\n {\r\n \"lun\": 0,\r\n \"name\": \"h11-dev-eastus-az1-disk-data\",\r\n \"createOption\": \"Empty\",\r\n \"caching\": \"None\",\r\n \"managedDisk\": {\r\n \"storageAccountType\": \"Premium_LRS\"\r\n },\r\n \"deleteOption\": \"Delete\",\r\n \"diskSizeGB\": 100,\r\n \"toBeDetached\": false\r\n }\r\n ],\r\n \"diskControllerType\": \"SCSI\"\r\n },\r\n \"osProfile\": {\r\n \"computerName\": \"h11-dev-eastus-az1\",\r\n \"adminUsername\": \"vespa\",\r\n \"linuxConfiguration\": {\r\n \"disablePasswordAuthentication\": false,\r\n \"provisionVMAgent\": true,\r\n \"patchSettings\": {\r\n \"patchMode\": \"ImageDefault\",\r\n \"assessmentMode\": \"ImageDefault\"\r\n },\r\n \"enableVMAgentPlatformUpdates\": false\r\n },\r\n \"secrets\": [],\r\n \"allowExtensionOperations\": true,\r\n \"requireGuestProvisionSignal\": true\r\n },\r\n \"securityProfile\": {\r\n \"encryptionAtHost\": true\r\n },\r\n \"networkProfile\": {\"networkInterfaces\":[{\"id\":\"/subscriptions/REDACTED/resourceGroups/dev.eastus-az1-tenant/providers/Microsoft.Network/networkInterfaces/h11-dev-eastus-az1-nic-8089b83e\",\"properties\":{\"primary\":false,\"deleteOption\":\"Delete\"}}]},\r\n \"timeCreated\": \"2024-02-09T10:40:16.6430377+00:00\"\r\n },\r\n \"zones\": [\r\n \"3\"\r\n ]\r\n}"}
The requested networkInterfaceConfigurations
name is h11-dev-eastus-az1-nic
, but the returned ID under networkInterfaces
is /subscriptions/REDACTED/resourceGroups/dev.eastus-az1-tenant/providers/Microsoft.Network/networkInterfaces/h11-dev-eastus-az1-nic-8089b83e
. Not included in the response are the public IPs, which also got the -8089b83e
suffix.
The osDisk
and dataDisks
name
is handled correctly.
[1] https://learn.microsoft.com/en-us/rest/api/compute/virtual-machines/create-or-update?view=rest-compute-2023-10-02&tabs=HTTP