Hello @A.M. Sabuncu ,
Thanks for your query !
Basically GetStorageConnectionStringAsync has to form the connection string which needs "StorageAccount" and "StorageKeys".
As reference to storage account was already established through StorageManagementClient in the main function which is local , hence that parameter is needed along with StorageAccountName in order to be accessible by other functions .
Also if you observe , when the resource group is being cleaned up at the end , it is expecting both the ResourcesManagementClient and the ResourceGroupName.
Of course , You can modify GetStorageConnectionStringAsync function in different ways:
1) Declare that StorageManagementClient variable globally and access that with out passing the parameter to any function
(OR)
2) Modify the function GetStorageConnectionStringAsync like below if you don't want to pass the storage account name:
For Example:
StorageAccountsOperations saOper = storage.StorageAccounts; //Create an instance of Storage Operations from StorageManagementClient
Pageable<StorageAccount> psa = saOper.List(); //Get all the Storage Accounts under subscriptions
//get the keys etc
Hope that helps . Let us know if you have additional questions !