Based on your title of the question "How to get the data from sharepoint library to azure ai search." - Azure AI Search has a SharePoint Online Indexer, which is in public preview.
Refer: https://learn.microsoft.com/en-us/azure/search/search-howto-index-sharepoint-online
While reading your detailed information, I assume you are already using this feature. You need to make sure the tenant you are trying to access must have a valid Sharepoint Online license. Refer the following thread and see whether it applies to your case.
https://learn.microsoft.com/en-us/answers/questions/1526573/tenant-does-not-have-a-spo-license