Apologies for late response. Here is some information that should help you.
Azure Functions lets you leverage PowerShell gallery for managing dependencies. Therefore, in general you don't have to upload any PS module along with your function code. More details are available at Dependency Management in Azure Functions (PowerShell). This helps in easing the dependency management as well as to keep the version of modules updated.
In this scenario, after enabling the "System assigned" identity, please ensure that requirements.psd1 file has the following line uncommented/added. This will automatically download required Az
modules.
'Az' = '6.*'
Also, if you check the profile.ps1 file in the root folder of functions created through Azure Portal or template (VSCode, core tools), it has the code to runs the Connet-AzAccount -Identity
when ManagedIdentity is enabled. Therefore, this need not be called again in the function code in that scenario.
Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.