def create_vnet(access_token, subscription_id, resource_group, name, location,
                address_prefix='10.0.0.0/16', subnet_prefix='10.0.0.0/16', nsg_id=None):
    '''Create a VNet with specified name and location. Optional subnet address prefix..

    Args:
        access_token (str): A valid Azure authentication token.
        subscription_id (str): Azure subscription id.
        resource_group (str): Azure resource group name.
        name (str): Name of the new VNet.
        location (str): Azure data center location. E.g. westus.
        address_prefix (str): Optional VNet address prefix. Default '10.0.0.0/16'.
        subnet_prefix (str): Optional subnet address prefix. Default '10.0.0.0/16'.
        nsg_id (str): Optional Netwrok Security Group resource Id. Default None.

    Returns:
        HTTP response. VNet JSON body.
    '''
    endpoint = ''.join([get_rm_endpoint(),
                        '/subscriptions/', subscription_id,
                        '/resourceGroups/', resource_group,
                        '/providers/Microsoft.Network/virtualNetworks/', name,
                        '?api-version=', NETWORK_API])

    vnet_body = {'location': location}
    properties = {'addressSpace': {'addressPrefixes': [address_prefix]}}
    subnet = {'name': 'subnet'}
    subnet['properties'] = {'addressPrefix': subnet_prefix}
    if nsg_id is not None:
        subnet['properties']['networkSecurityGroup'] = {'id': nsg_id}
    properties['subnets'] = [subnet]
    vnet_body['properties'] = properties
    body = json.dumps(vnet_body)
    return do_put(endpoint, body, access_token)
Create a VNet with specified name and location. Optional subnet address prefix..

    Args:
        access_token (str): A valid Azure authentication token.
        subscription_id (str): Azure subscription id.
        resource_group (str): Azure resource group name.
        name (str): Name of the new VNet.
        location (str): Azure data center location. E.g. westus.
        address_prefix (str): Optional VNet address prefix. Default '10.0.0.0/16'.
        subnet_prefix (str): Optional subnet address prefix. Default '10.0.0.0/16'.
        nsg_id (str): Optional Netwrok Security Group resource Id. Default None.

    Returns:
        HTTP response. VNet JSON body.