How can I configure a network interface controller name by using extensibility actions

You can configure the interface name of a network interface controller (NIC) by using IaaS API calls applied through extensibility actions.
  • You can only configure the NIC interface name prior to provisioning a compute resource. Therefore, only the
    Compute Provision
    event topic can be selected for relevant extensibility subscriptions.
  • You can only configure NIC interface names for NICs that use
    Microsoft Azure
    as a provider.
To configure the interface name of a NIC, you must make
GET
and
PATCH
calls to the
VMware Aria Automation
IaaS API. By making a
GET
call to https://
your_vRA_fqdn
/iaas/api/machines/
{id}
, you can retrieve the NIC link for the compute resource you want to modify. Then you can make a
PATCH
call to https://
your_vRA_fqdn
/iaas/api/machines/
{id}
/network-interfaces/
{nicld}
, which includes the NIC interface name as a payload, to add the new name for your NIC.
The following scenario uses a sample Python script that can be used for NIC interface name configuration. For your own use cases, you can use a different script and script language, such as Node.js.
  1. Create the extensibility action.
    1. Navigate to
      Extensibility
      Actions
      .
    2. Click
      New Action
      .
    3. Enter a name and project for the extensibility action and
      Next
      .
    4. Add the NIC configuration script.
      The following is a sample Python script:
      import json def handler(context, inputs): # Get the machine info, which contains machine nic link response = context.request('/iaas/api/machines/'+inputs["resourceIds"][0], "GET", {}) # Build PATCH machine nic payload here name = "customized-nic-02"; data = {'name':name}; # Convert machine data string to json object response_json = json.loads(response["content"]) # Patch machine nic response_patch = context.request(response_json["_links"]["network-interfaces"]["hrefs"][0] + "?apiVersion=2021-07-15", 'PATCH', data) # return value is empty since we are not changing any compute provisioning parameters outputs = {} return outputs
      The preceding sample script performs two primary operations through the IaaS API. First, the script uses a
      GET
      call to retrieve the NIC link and then uses a
      PATCH
      call to apply the interface name. In this sample, the NIC interface name is hard-coded into the script as
      "customized-nic-02"
      .
    5. To finish editing the extensibility action, click
      Save
      .
  2. Create a extensibility subscription.
    1. Navigate to
      Extensibility
      Subscriptions
      .
    2. Click
      New Subscription
      .
    3. Enter a name for the extensibility subscription.
    4. Under
      Event Topic
      , select
      Compute Provision
      as the event topic for the extensibility subscription.
    5. Under
      Action/workflow
      , select the extensibility action you created for NIC configuration.
    6. Enable event blocking.
      By enabling blocking, you make sure that the provisioning process is blocked until the extensibility action finishes its run.
    7. To finish editing the extensibility subscription, click
      Save
      .
The new extensibility subscription runs when a compute provision event is triggered and configures the NIC interface name for the compute resources to be provisioned.