def create_nic(access_token, subscription_id, resource_group, nic_name, public_ip_id, subnet_id,<EOL>location, nsg_id=None):
endpoint = '<STR_LIT>'.join([get_rm_endpoint(),<EOL>'<STR_LIT>', subscription_id,<EOL>'<STR_LIT>', resource_group,<EOL>'<STR_LIT>', nic_name,<EOL>'<STR_LIT>', NETWORK_API])<EOL>nic_body = {'<STR_LIT:location>': location}<EOL>ipconfig = {'<STR_LIT:name>': '<STR_LIT>'}<EOL>ipc_properties = {'<STR_LIT>': '<STR_LIT>'}<EOL>ipc_properties['<STR_LIT>'] = {'<STR_LIT:id>': public_ip_id}<EOL>ipc_properties['<STR_LIT>'] = {'<STR_LIT:id>': subnet_id}<EOL>ipconfig['<STR_LIT>'] = ipc_properties<EOL>properties = {'<STR_LIT>': [ipconfig]}<EOL>if nsg_id is not None:<EOL><INDENT>properties['<STR_LIT>'] = {'<STR_LIT:id>': nsg_id}<EOL><DEDENT>nic_body['<STR_LIT>'] = properties<EOL>body = json.dumps(nic_body)<EOL>return do_put(endpoint, body, access_token)<EOL>
Create a network interface with an associated public ip address.

    Args:
        access_token (str): A valid Azure authentication token.
        subscription_id (str): Azure subscription id.
        resource_group (str): Azure resource group name.
        nic_name (str): Name of the new NIC.
        public_ip_id (str): Public IP address resource id.
        subnetid (str): Subnet resource id.
        location (str): Azure data center location. E.g. westus.
        nsg_id (str): Optional Network Secruity Group resource id.

    Returns:
        HTTP response. NIC JSON body.