Search code examples
azureazure-blueprints

Azure Blueprint invalid artifacts function


I'm developing an Azure Blueprint with three artifacts:

  • A log analytics workspace
  • Two policy assignments that reference this log analytics workspace

Artifacts

To be able to reference log analytics workspace in policy assignments, I exported resource id of this log analytics workspace

  "outputs": {
    "id": {
      "type": "string",
      "value": "[resourceId('Microsoft.OperationalInsights/workspaces', variables('workspaces_manage_log_analytics_name'))]"
    }
  }

In policy assignments, I tried to refer to the log analytics workspace id with [artifacts('LogAnalyticsWorkspace').outputs.id], but ended with an error

enter image description here

This error says this reference is invalid. I checked artifacts function document, but with no luck to solve this problem.


Solution

  • In portal, users can assign "display name", but not "name" to artifacts. If users want to assign "name" to an artifact, they need to use Powershell to export blueprint, rename json file, and import the modified blueprint.

    For the question, "LogAnalyticsWorkspace" is not a "name", but only a "display name". You need to assign "name" by yourself.