Shaikh Muhammad Baazmool (may Allaah preserve him) stated:
Ascription to a tribe is an affair confirmed (or established) by the (Islamic) legislation. [Allaah (The Most High) said]:
يَا أَيُّهَا النَّاسُ إِنَّا خَلَقْنَاكُم مِّن ذَكَرٍ وَأُنثَىٰ وَجَعَلْنَاكُمْ شُعُوبًا وَقَبَائِلَ لِتَعَارَفُوا ۚ إِنَّ أَكْرَمَكُمْ عِندَ اللَّهِ أَتْقَاكُمْ ۚ إِنَّ اللَّهَ عَلِيمٌ خَبِيرٌ
O mankind! We have created you from a male and a female, and made you into nations and tribes, that you may know one another. Verily, the most honourable of you with Allah is that (believer) who has the most Taqwah. Verily, Allah is All-Knowing, All-Aware. [49:13]
Some Benefits derived from the above Ayah:
[لِتَعَارَفُوا – that you may know one another]; so that you may know one another and how close you all are to one another in lineage, but not out of boastfulness. Then Allaah informed us that the most elevated amongst them (i.e the children of Aadam) are those who fear Allaah the most.
The Prophet (salla-laahu-alayhi-wasalam) said: “Learn your lineages so that you can maintain ties of kinship…..’’ [Reported by Imaam Tirmidhee (rahimahullaah) Number 1979 & declared authentic by Imaam Albani (rahimahullaah) in Sahih Sunan At-Tirmidhee. Also see links on Ref 1 at the end of this article about keeping the ties of kinship, but not out of boastfulness]
Therefore, ascription to a tribe and a nation is affirmed in Islaam. The companions of the Prophet (sallal-laahu-alayhi-wasallam) used to ascribe themselves to their tribes and their people in the presence of the Messenger (sallal-laahu-alayhi-wasallam), and he never disapproved of that.
[Source: Silsilah Ar-Rasaa’il Al-Manhajiyyah Fin-Nus’hi Wal Irshaad Wat-Taw’iyah’ pages 47-49 Abridged and slightly paraphrased]
Ref 1: It is recommended that we know our lineages and it is obligatory to keep the ties of kinship, but we are not to be boastful about lineages. See articles below.