@Shekar Yenagandula I did some testing and see that the below Powershell script is giving output of fileshares for multiple subscriptions.
Please try the below script and let me know if this helps. This script will work for storage accounts with public network access enabled or disabled. However, if public network access is disabled, you will need to use a service principal or managed identity to authenticate the PowerShell session. You can use the Azure AD PowerShell cmdlets to create a service principal and grant it access to the storage accounts you want to backup. Then, you can use the service principal credentials to sign in to Azure and run the script.
foreach ($subscription in $subscriptions)
{Get-AzSubscription -SubscriptionName $subscription.Name | Set-AzContext
# Get the list of storage accounts
$storageAccounts = Get-AzStorageAccount
# Loop through each storage account
foreach ($storageAccount in $storageAccounts)
{
# Get the list of file shares in the storage account
$fileShares = Get-AzStorageShare -Context $storageAccount.Context
# Print the storage account name and file share names
Write-Output "Storage account: $($storageAccount.StorageAccountName)"
Write-Output "File shares: $($fileShares.Name -join ", ")"
}
}