azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

[Functions] Update logic to populate tab completers and cache in the New-AzFunctionApp cmdlet

Open Francisco-Gamino opened this issue 1 year ago • 3 comments

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:

  1. When Az.Functions is imported, if there is no active Azure PowerShell session, the tab completers and cache should not be populated.

  2. 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-AzFunctionApp cmdlet. It is important to note that the tab completers will not be populated until the New-AzFunctionApp cmdlet is invoked for the first time. Subsequently, the tab completers will be available from the second invocation of the New-AzFunctionApp cmdlet onwards. b. The user invokes any cmdlet from the Az.Functions module.

Issue script & Debug output

N/A

Environment data

N/A

Module versions

N/A

Error output

N/A

Francisco-Gamino avatar Dec 19 '23 19:12 Francisco-Gamino

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)

isra-fel avatar Jan 19 '24 06:01 isra-fel

Moving the release date for work item to Az 11.5.0 .

/cc @anatolib @andystaples @shreyabatra4

Francisco-Gamino avatar Feb 07 '24 18:02 Francisco-Gamino

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.

Francisco-Gamino avatar Apr 25 '24 18:04 Francisco-Gamino

This issue has been fixed.

Francisco-Gamino avatar Jun 10 '24 16:06 Francisco-Gamino