[AspireDeployment] Initializing an Aspire project without 'Subscription', 'Location' will send an incorrect Prompt request on RefreshEnvironment
After running azd init on a brand new Aspire Application, executing RefreshEnvironmentAsync() on it will cause azd vs-sever to send a Prompt request -asking for missing 'Subscription' and 'Location'- though its content is not correct, as it does not adhere to VS IDE Prompt request JSON definition.
From debugging the code, the request sent from azd vs-server has the form of:
{ "type":"select", "options":{ "message":"Select an Azure Subscription to use:", "help":"", "choices":[ {"value":" 1. <Sub_Name> (<Sub_ID>)"}, {"value":" 2. ...} .... ] } }
But VS IDE defines another schema. Look at https://devdiv.visualstudio.com/DevDiv/_git/WebTools?path=/docs/Aspire/AzdHttpPrompting.md&version=GBmain&_a=contents.
{ "id": "myId", "kind": "select", "displayName": "MyLabel", "description": "My help description", "defaultValue": "Value1", "required": true, "choices": [ { "value": "Value1", "description": "Value1 description" }, { "value": "Value2" }, { "value": "Value3" } ]
For starters, there is no type field, but kind.
Repro steps:
- Launch VS and create a new Aspire starter Application project.
- Create a new environment with azd command for the project.
- Right-click solution/AppHost project > Open folder in file explorer
- In the opened folder, right-click any place > open in terminal
- Runing 'azd init', select 'Use code in the current directory' > Confirm and continue initializing my app, type a new environment name, and press Enter
- Right click on the AppHost project -> Publish.
- Prompt request is sent, but VS IDE cannot parse it correctly, presenting an empty dialog.
Original Bug: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2057823
@ellismg @weikanglim can you triage this?
I'll take a look - I suspect this is in an issue with when we initialize the bicep provider - but it does seem bad that we are sending an incorrect shape in our API request.
Thanks for the detailed repo steps here, @anvillan!