Skip to content

Conversation

@wiebeck
Copy link
Contributor

@wiebeck wiebeck commented Apr 27, 2021

Description
Deploying template specs currently does not work. The API version 2021-03-01-preview returns a template spec with mainTemplate as part of properties while the code in src/azure-cli/azure/cli/command_modules/resource/custom.py tries to access key template which has been the name of the key in API version 2019-06-01-preview.

This PR fixes #17733

The code contains other places where dict key template is being referenced but I am unsure whether this plays a role for this particular case (deploy a template spec version).

Testing Guide
See #17733 for a detailed explanation, especially this comment by @tonystz.


This checklist is used to make sure that common guidelines for a pull request are followed.

@ghost ghost added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Apr 27, 2021
@ghost
Copy link

ghost commented Apr 27, 2021

Thank you for your contribution wiebeck! We will review the pull request and get back to you soon.

@detienne20
Copy link
Contributor

detienne20 commented Apr 27, 2021

This is not the proper fix for this. I was able to repro this issue (see discussion) and the key points to notice from the --debug output are :

A. { Request URL: 'https://management.azure.com/subscriptions/a1bfa635-f2bf-42f1-86b5-848c674fc321/providers/Microsoft.Resources?api-version=2020-10-01' }

B. { Request URL: 'https://management.azure.com/subscriptions/a1bfa635-f2bf-42f1-86b5-848c674fc321/resourceGroups/TemplateSpecsCLI/providers/Microsoft.Resources/templateSpecs/BugTest/versions/1.0?api-version=2021-03-01-preview' }

Azure CLI currently points to Microsoft.Resources version 2020-10-01 and Template Specs 2019-06-01-preview. It looks this PR:
( https://github.com/Azure/azure-rest-api-specs/pull/13811}
may have caused Microsoft.Resources version 2020-10-01 to be updated to use the latest (template-spec) client(s). This means that 'az deployment group create --template-spec' is now using template spec 2021-03-01-preview instead of 2019-06-01-preview as it should be.

This has caused a regression in Azure CLI. The code is CLI has not been updated for 2021-03-01 preview which has a few breaking changes for template specs; most notably the 'template' property has been replaced by 'main_template'. As a result the code in the CLI attempts to retrieve the 'template' property from the --template-spec input and fails.

Although the TemplateSpecs API will be update for CLI when a proper SDK release for Python is done (https://github.com/Azure/sdk-release-request/issues/1469) , (ref: https://github.com/Azure/azure-cli/pull/17869/files) in the meantime I will send a fix for this and notify swagger team of the issue so they may prevent it in the future.

@detienne20
Copy link
Contributor

Please review #17896 for fix.

@wiebeck
Copy link
Contributor Author

wiebeck commented Apr 27, 2021

Hi @detienne20. Thanks for taking a look. I was hoping for someone more into it to take a look at my PR. Although yours is basically the same thing except for the template fallback and test fixes I will happily close this PR and subscribe to yours. :) Hopefully this gets resolved very soon because it really blocks us. Thanks again for taking over.

@wiebeck wiebeck closed this Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

customer-reported Issues that are reported by GitHub users external to the Azure organization.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants