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

VSCode Extension v0.12.1 and above - ARM template build adds API version for AutomationAccount #9506

Open
JCoreMS opened this issue Jan 10, 2023 · 9 comments
Assignees

Comments

@JCoreMS
Copy link

JCoreMS commented Jan 10, 2023

Bicep version
v0.12.1 and above - Issue Noted
v0.11.1 and below - working as expected

Describe the bug
Bug in VSCode Bicep v0.12.1 and above.

  • Related to the nested deployments for Logic Apps in which a webhook is created with an automation account
  • Symptoms are that the Logic App will not have the URI populated for the HTTP action as it is returned as null
  • Deployment via BICEP file works fine in later versions but the ARM template created has the API version when it should not.
  • "Microsoft.Logic/workflows" properties for the URI reference the webhook and include the API version which is considered out of scope and thus a NULL value

These snippets are from my AVD Alerts GitHub Repository:
https://github.com/JCoreMS/AVDAlerts
\deploySubscription\solution.json (Current version is v0.11.1 and working)

  • around line 1828

v0.12.1 and above (Not Working)
"uri": "[reference(resourceId('Microsoft.Automation/automationAccounts/webhooks', parameters('AutomationAccountName'), format('{0}_{1}', parameters('RunbookNameGetStorage'), dateTimeAdd(parameters('Timestamp'), 'PT0H', 'yyyyMMddhhmmss'))), '2018-06-30').uri]",

v0.11.1 (Working)
"uri": "[reference(resourceId('Microsoft.Automation/automationAccounts/webhooks', parameters('AutomationAccountName'), format('{0}_{1}', parameters('RunbookNameGetStorage'), dateTimeAdd(parameters('Timestamp'), 'PT0H', 'yyyyMMddhhmmss')))).uri]",

To Reproduce
Steps to reproduce the behavior:
Compile BICEP from AVD Alerts or with nested deployments for an Automation Account with VS Code's BICEP extension version 0.12.1 or above incorporating a webhook. When deploying an automation account and runbook with HTTP and using a webhook, the webhook URI isn't captured and thus empty for the URI for the HTTP action in the workflow.

Additional context
Add any other context about the problem here.

@ghost ghost added the Needs: Triage 🔍 label Jan 10, 2023
@JCoreMS
Copy link
Author

JCoreMS commented Jan 11, 2023

Tested v0.13.1 VS Code extension as well and still has the same problem.

@shenglol
Copy link
Contributor

@JCoreMS This is a deliberate change we decided to make, and we are not planning to switch back to the old behavior. The root cause of this issue is that the PUT response and GET response for automationAccounts resource returned from the Automation RP is inconsistent. If a reference function contains the API version parameter, ARM will always send a GET request to evaluate the reference function, whereas without the API version, ARM might use the PUT response instead to do evaluation depending on whether the resource type supports asynchronous PUT.

To fix the issue, the Automation RP will need to update their service to return the uri property. For now, you may use the reference function with API version in Bicep as a workaround, for example:

-automationAccount.properties.uri
+reference(automationAccount.name, '2018-06-30').uri

@JCoreMS
Copy link
Author

JCoreMS commented Jan 12, 2023

@shenglol I tried the above approach but got a template validation failure. Any idea when the Automation RP will update their service? It seems like this should have been a coordinated change to ensure we don't impact functionality of existing deployments that have been developed.

@shenglol
Copy link
Contributor

Could you let me know what the template validation failure is?

I don't know if there's an ETA for the Automation RP to fix the behavior. @alex-frankel do we have any plan to sync with the Automation RP to discuss the issue?

@anthony-c-martin
Copy link
Member

It would be interesting to test whether the symbolicNameCodegen experimental feature fixes this: https://github.com/Azure/bicep/blob/main/docs/experimental-features.md#symbolicnamecodegen

@hribeiro-msft
Copy link

It would be interesting to test whether the symbolicNameCodegen experimental feature fixes this: https://github.com/Azure/bicep/blob/main/docs/experimental-features.md#symbolicnamecodegen

This worked for me

@anthony-c-martin
Copy link
Member

Related issue: Azure/bicep-types-az#2076

@anthonyAA11
Copy link

It would be interesting to test whether the symbolicNameCodegen experimental feature fixes this: https://github.com/Azure/bicep/blob/main/docs/experimental-features.md#symbolicnamecodegen

This worked for me

Hello @anthony-c-martin,
Could you share an example using symbolicNameCodegen please ?

@anthony-c-martin
Copy link
Member

It would be interesting to test whether the symbolicNameCodegen experimental feature fixes this: https://github.com/Azure/bicep/blob/main/docs/experimental-features.md#symbolicnamecodegen

This worked for me

Hello @anthony-c-martin, Could you share an example using symbolicNameCodegen please ?

You don't need to change anything in your .bicep files, you just need to turn the feature on - see https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-config#enable-experimental-features

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants