Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
MartinaHawkins
Frequent Visitor

Index was out of range. Must be non-negative and less than the size of the collection.

Hi, I am getting this error when trying to connect an Azure Storage datalake V2 table to Power BI.

 

Can anyone please explain what this means or what the solution is

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @MartinaHawkins 

The error message “Index was out of range. Must be non-negative and less than the size of the collection” typically indicates that an invalid index has been used when accessing a collection, such as an array or list. Specifically, this means that the index you are trying to access is either negative or exceeds the size of the collection.

 

I have looked into several solutions for similar issues you might be facing, and you can try the following steps:

1.Firstly, please check that the URL you have entered for Data Lake Storage Gen2 meets the required specifications.

 Here is a screenshot from the relevant documentation:

vlinyulumsft_0-1730957583854.png

For further details, please refer to the documentation.

Azure Data Lake Storage Gen2 - Power Query | Microsoft Learn
Analyze data in Azure Data Lake Storage Gen2 by using Power BI - Power Query | Microsoft Learn
 

2.Secondly, ensure that the correct ports are open for your network/firewall.

vlinyulumsft_1-1730957583857.png

For more information, please consult the documentation.

Azure AD Connect Error - ArgumentOutOfRangeException: Index was out of range - Microsoft Q&A

https://learn.microsoft.com/en-us/azure/active-directory/hybrid/reference-connect-ports#table-1---az...

 

3.Next, based on another document related to the same error, you might also consider upgrading Az.Resources to see if that resolves the issue:

vlinyulumsft_2-1730957652337.png

For detailed guidance, please refer to the documentation.

PowerShell Gallery | Az.Resources 7.5.0

Get-AzRoleAssignment: Index was out of range. Must be non-negative and less than the size of the col...

 

4.Finally, you could try changing the account privileges to see if that helps resolve the problem.

vlinyulumsft_3-1730957652342.png

Azure AD Connect Error - ArgumentOutOfRangeException: Index was out of range - Microsoft Q&A
Microsoft Entra Connect: Accounts and permissions - Microsoft Entra ID | Microsoft Learn


Of course, if you have any new discoveries or questions, please feel free to get in touch with us.
 

Best Regards,

Leroy Lu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi, @MartinaHawkins 

The error message “Index was out of range. Must be non-negative and less than the size of the collection” typically indicates that an invalid index has been used when accessing a collection, such as an array or list. Specifically, this means that the index you are trying to access is either negative or exceeds the size of the collection.

 

I have looked into several solutions for similar issues you might be facing, and you can try the following steps:

1.Firstly, please check that the URL you have entered for Data Lake Storage Gen2 meets the required specifications.

 Here is a screenshot from the relevant documentation:

vlinyulumsft_0-1730957583854.png

For further details, please refer to the documentation.

Azure Data Lake Storage Gen2 - Power Query | Microsoft Learn
Analyze data in Azure Data Lake Storage Gen2 by using Power BI - Power Query | Microsoft Learn
 

2.Secondly, ensure that the correct ports are open for your network/firewall.

vlinyulumsft_1-1730957583857.png

For more information, please consult the documentation.

Azure AD Connect Error - ArgumentOutOfRangeException: Index was out of range - Microsoft Q&A

https://learn.microsoft.com/en-us/azure/active-directory/hybrid/reference-connect-ports#table-1---az...

 

3.Next, based on another document related to the same error, you might also consider upgrading Az.Resources to see if that resolves the issue:

vlinyulumsft_2-1730957652337.png

For detailed guidance, please refer to the documentation.

PowerShell Gallery | Az.Resources 7.5.0

Get-AzRoleAssignment: Index was out of range. Must be non-negative and less than the size of the col...

 

4.Finally, you could try changing the account privileges to see if that helps resolve the problem.

vlinyulumsft_3-1730957652342.png

Azure AD Connect Error - ArgumentOutOfRangeException: Index was out of range - Microsoft Q&A
Microsoft Entra Connect: Accounts and permissions - Microsoft Entra ID | Microsoft Learn


Of course, if you have any new discoveries or questions, please feel free to get in touch with us.
 

Best Regards,

Leroy Lu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.