Share via

Create a VMss using python sdk.

Anjali Gobari 0 Reputation points
2023-02-08T07:01:50.0566667+00:00

I have been trying to create Virtual machine scale set using python sdk, the following API is used

compute_client.virtual_machine_scale_sets.begin_create_or_update

However i am getting error "Code: NetworkApiVersionMustBeSpecifiedWithNetworkInterfaceConfigurations

Message: Network api version in network profile of virtual machine /subscriptions/xyzzzzzd/resourceGroups/hjmjkhjh/providers/Microsoft.Compute/virtualMachines/SdaCareVss_495396a6 must be specified if network interface configurations are specified."

I checked the constructor for network profile and don't see api-version as properties. but still added and the error exists, please assist.

PFB the network profile code under the virtualMachine Profile.

"networkProfile": {
                        "networkInterfaceConfigurations": [
                            {
                                "name": "xyz",
                                
                                "properties": {
                                    
                                    "primary": True,
                                    "enableAcceleratedNetworking": False,
                                    "disableTcpStateTracking": False,
                                    "networkSecurityGroup": {
                                        "id":"/subscriptions/"+SUBSCRIPTION_ID+"/resourceGroups/"+GROUP_NAME+"/providers/Microsoft.Network/networkSecurityGroups/"+NETWORK_SECURITY_GROUP_NAME
										
                                    },
                                    "dnsSettings": {
                                        "dnsServers": []
                                    },
                                    "enableIPForwarding": False,
                                    "ipConfigurations": [
                                        {
                                            "name": "abc",
                                            "properties": {
                                                
                                                "primary": True,
                                                "subnet": {
                                                    "id": "/subscriptions/"+SUBSCRIPTION_ID+"/resourceGroups/"+GROUP_NAME+"/providers/Microsoft.Network/virtualNetworks/"+VIRTUAL_NETWORK_NAME+"/subnets/"+ SUBNET_NAME
													
                                                },
                                                "privateIPAddressVersion": "IPv4",
                                                
                                                
                                            }
                                        }
                                    ]
                                }
                            }
                        ]
                    },	
Azure Virtual Machines
Azure Virtual Machines

An Azure service that is used to provision Windows and Linux virtual machines.

0 comments No comments

1 answer

Sort by: Most helpful
  1. vipullag-MSFT 26,537 Reputation points Moderator
    2023-02-27T09:24:26.2266667+00:00

    Hello Anjali Gobari
    Welcome to Microsoft Q&A Platform, thanks for posting your query here.

    The error message is indicating that the API version of the network profile in your virtual machine scale set definition is missing. You need to specify the API version for the network profile in order to create the virtual machine scale set.

    To resolve the error "NetworkApiVersionMustBeSpecifiedWithNetworkInterfaceConfigurations", you need to specify the API version for the network profile in the VirtualMachineScaleSet model. You can add the following line in the network profile properties:

    apiVersion": "2020-06-01",

    The updated network profile code would look like below:

    "networkProfile": { 
    "networkInterfaceConfigurations": [ 
    {
    "properties": { 
    "apiVersion": "2020-06-01",
    "primary": True, 
    "enableAcceleratedNetworking": False, 
    "disableTcpStateTracking": False,
    

    Hope this helps.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.