Azure / azure-cli

Azure Command-Line Interface
MIT License
4.03k stars 3.01k forks source link

Can't upgrade static web apps github setting #22668

Open onlyillusion opened 2 years ago

onlyillusion commented 2 years ago

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

Related command

az staticwebapp update --name static-webapps --source https://github.com/xxx --branch main --token {{PAT}}

Describe the bug

When trying to update existing static web app with new private github repo setttings there is an error Error code BadRequest Message RepositoryToken is invalid. Please ensure the Github repository exists and the RepositoryToken is for an admin of the repository. But when you create new one with the same token - everything ok. When you trying to update existing static webapp with public github settings - everything ok Problem related only updating private github repo settings. Is there any chance to create new static web app without github part and then update to use with private github repo?

To Reproduce

az staticwebapp create -n {{MyStaticAppName}} -g {{someresourcegroup}} -l eastus2 az staticwebapp update -n {{MyStaticAppName}} -g {{someresourcegroup}} --source {{https://github.com/private_repo}} --branch {{master}} --token {{PAT}} Expected behavior

Environment summary

azure-cli 2.36.0 core 2.36.0 telemetry 1.0.6 Extensions: aks-preview 0.5.42 Dependencies: msal 1.17.0 azure-mgmt-resource 20.0.0 Python (Linux) 3.8.13 [GCC 9.4.0]

Additional context

yonzhan commented 2 years ago

route to CXP team

navba-MSFT commented 2 years ago

@onlyillusion Apologies for the late reply. Thanks for reaching out to us and reporting this issue. We are looking into this issue and we will provide an update.

navba-MSFT commented 2 years ago

@onlyillusion I am yet to do a repro at my end and check the failure. But before that I wanted to confirm if you have tested with the below commands and check if that worked ? I am just trying to avoid the duplicate efforts.

az resource update --ids /subscriptions/XXXXXXX/resourceGroups/XXXX/providers/Microsoft.Web/staticSites/MyStaticApp --set properties.repositoryToken=XXXXXXXXXX properties.repositoryUrl="https://github.com/XXXXX/XXXXX" --api-version 2021-03-01

Awaiting your reply.

onlyillusion commented 2 years ago

I am yet to do a repro at my end and check the failure. But before that I wanted to confirm if you have tested with the below commands and check if that worked ? I am just trying to avoid the duplicate efforts.

@navba-MSFT Hi No,didnt checked using your command. I used only "az staticwebapp update" command for updating.

navba-MSFT commented 2 years ago

@onlyillusion Thanks for getting back. I have tried the above command and confirmed that it also failed with Bad Request ( 400 ) error. Based on the debug log, this doesn’t seem caused by the CLI. The CLI command is failing because the PATCH API is returning a 400 status in this case. I am discussing this with the Product Owners further and update this GitHub thread once I hear from them.

navba-MSFT commented 2 years ago

@onlyillusion Apologies for the delay. I am still waiting for the reply from the Product Owners. I will keep you posted.

navba-MSFT commented 2 years ago

Adding Service team to look into this.