Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

staticwebapp appsettings set: Support environments #22552

Open
anthonychu opened this issue May 20, 2022 · 6 comments
Open

staticwebapp appsettings set: Support environments #22552

anthonychu opened this issue May 20, 2022 · 6 comments
Labels
Auto-Assign Auto assign by bot feature-request Service Attention This issue is responsible by Azure service team. staticwebapp az staticwebapp
Milestone

Comments

@anthonychu
Copy link
Member

anthonychu commented May 20, 2022

Related command
az staticwebapp appsettings set

Is your feature request related to a problem? Please describe.
Cannot configure app settings for environments other than production.

Describe the solution you'd like
Add a --environment parameter. If supplied, app setting changes are applied to the environment specified, instead of production.

Describe alternatives you've considered
Call az rest directly.

Additional context
Static Web Apps supports preview environments. It's not possible to configure app settings for these environments with Azure CLI.

/cc @DarqueWarrior

Azure/static-web-apps#677 (comment)

@ghost ghost added Auto-Assign Auto assign by bot CXP Attention This issue is handled by CXP team. labels May 20, 2022
@ghost ghost assigned jiasli May 20, 2022
@ghost ghost added this to the Backlog milestone May 20, 2022
@ghost ghost added the staticwebapp az staticwebapp label May 20, 2022
@DarqueWarrior
Copy link

DarqueWarrior commented May 20, 2022 via email

@yonzhan
Copy link
Collaborator

yonzhan commented May 20, 2022

route to CXP team

@navba-MSFT navba-MSFT added feature-request Service Attention This issue is responsible by Azure service team. and removed CXP Attention This issue is handled by CXP team. labels May 25, 2022
@navba-MSFT
Copy link
Contributor

@anthonychu @DarqueWarrior Apologies for the late reply. Thanks for reaching out to us and sharing this feedback. Adding the Service team to take a look into this.

@micklaw
Copy link

micklaw commented Feb 16, 2023

@anthonychu @DarqueWarrior

Would it be possible to give this a bump, feels like this is quite a significant oversight for folks wanting to make use of preview environments.

@anthonychu
Copy link
Member Author

/cc @thomasgauvin @Reshmi-Sriram

While not ideal, you can use az rest to manage this for the time being. Environments are under Microsoft.Web/staticSites/.../builds in the API.

List environments

az rest -m GET -u "/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCE_GROUP_NAME/providers/Microsoft.Web/staticSites/SWA_NAME/builds?api-version=2022-03-01" -o json

Fetch app settings in an environment and output a file

az rest -m POST -u "/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCE_GROUP_NAME/providers/Microsoft.Web/staticSites/$SWA_NAME/builds/$BUILD_NAME/listappsettings?api-version=2022-03-01" -o json > env-app-settings.json

$BUILD_NAME is the environment name (name property from the list environments call above).

Update app settings

Open the file and edit the app settings. Then run:

az rest -m PUT -u "/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCE_GROUP_NAME/providers/Microsoft.Web/staticSites/$SWA_NAME/builds/$BUILD_NAME/config/appsettings?api-version=2022-03-01" --body @env-app-settings.json -o json

@thomasgauvin
Copy link

Hey folks! This has now been completed and you should be able to access it in the latest release of the Az CLI: https://github.com/MicrosoftDocs/azure-docs-cli/blob/main/docs-ref-conceptual/release-notes-azure-cli.md#april-25-2023-1

The update to the Az CLI docs will come out shortly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot feature-request Service Attention This issue is responsible by Azure service team. staticwebapp az staticwebapp
Projects
None yet
Development

No branches or pull requests

7 participants