azure-powershell
azure-powershell copied to clipboard
[Functions] Update logic to populate tab completers and cache in the New-AzFunctionApp cmdlet
Description
Currently, the tab completers for the Runtime and RuntimeVersion parameters in the New-AzFunctionApp cmdlet are populated upon importing the Az.Functions module. However, this operation requires calling an ARM API with authentication. If there is no active session, this operation will result in an error. Additionally, this operation is used to create a cache with configuration options for creating function apps in the Functions service. To address this behavior, we propose the following steps:
-
When
Az.Functionsis imported, if there is no active Azure PowerShell session, the tab completers and cache should not be populated. -
Next, we should populate the tab completer and build the cache only when there is an active Azure PowerShell session and under these conditions: a. The user invokes the
New-AzFunctionAppcmdlet. It is important to note that the tab completers will not be populated until theNew-AzFunctionAppcmdlet is invoked for the first time. Subsequently, the tab completers will be available from the second invocation of theNew-AzFunctionAppcmdlet onwards. b. The user invokes any cmdlet from theAz.Functionsmodule.
Issue script & Debug output
N/A
Environment data
N/A
Module versions
N/A
Error output
N/A
For all that stumble accross this issue, currently the work-arounds are:
Run Connect-AzAccount to sign in before Import-Module Az, or Do not explictly Import-Module Az at all. (Only works if your script doesn't depend on Az.Functions module)
I've verified that this issue has been fixed in Az 11.6.0. We are waiting for the release to customers before closing this issue.
This issue has been fixed.