xiaohongshu
xiaohongshu
Expert knowledge for using Azure Resource Manager (ARM) template functions, especially reference(), listKeys(), and resourceId() in subscription-level and nested deployments. Use when working with ARM templates, encountering template validation errors, or implementing cross-scope resource referen...
Full skill instructions
Valid Usage Locations:
Scope Considerations:
// ✅ CORRECT: Simple reference in same scope
"outputs": {
"myOutput": {
"value": "[reference('myResourceName').someProperty]"
}
}
// ❌ INCORRECT: Cannot nest reference() inside other functions in outputs
"outputs": {
"myOutput": {
"value": "[listKeys(resourceId('rg', 'type', reference('dep').outputs.name.value))]"
}
}
Nested Deployment References:
reference(deploymentName).outputs.propertyName.value for outputsexpressionEvaluationOptions.scope: inner in nested deploymentreference() inside resourceId() or listKeys() in outputsConditional Deployment Warning:
reference() evaluates even if resource is conditionally not deployedRequirements:
Valid Pattern:
"outputs": {
"storageKey": {
"value": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('name')), '2023-01-01').keys[0].value]"
}
}
Security Warning:
Resource Group Scope (default):
"[resourceId('Microsoft.Storage/storageAccounts', parameters('name'))]"
// Returns: /subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.Storage/storageAccounts/{name}
Cross-Resource Group:
"[resourceId(parameters('resourceGroupName'), 'Microsoft.Storage/storageAccounts', parameters('name'))]"
Subscription Scope:
"[subscriptionResourceId('Microsoft.EventHub/namespaces', parameters('name'))]"
// Returns: /subscriptions/{sub}/providers/Microsoft.EventHub/namespaces/{name}
⚠️ CRITICAL: Cross-Scope from Subscription Template to Resource Group Resources
When in a subscription-level template referencing resources IN a resource group:
// ❌ WRONG - Will fail with "not valid subscription identifier"
"[resourceId(parameters('resourceGroupName'), 'Microsoft.Storage/storageAccounts', parameters('name'))]"
// ✅ CORRECT - Must include subscription ID
"[resourceId(subscription().subscriptionId, parameters('resourceGroupName'), 'Microsoft.Storage/storageAccounts', parameters('name'))]"
This applies to:
Management Group/Tenant:
"[tenantResourceId('Microsoft.Authorization/policyDefinitions', parameters('name'))]"
⚠️ Critical: In subscription-level templates, use subscriptionResourceId() NOT resourceId() for subscription-scoped resources.
Cause: Using reference() inside another function in outputs section
Solution: Store the referenced value in variables, or restructure to avoid nested reference calls:
// ❌ INCORRECT
"outputs": {
"connectionString": {
"value": "[listKeys(resourceId('rg', 'type', reference('deployment').outputs.name.value))]"
}
}
// ✅ CORRECT: Use parameters or variables for the name
"outputs": {
"connectionString": {
"value": "[listKeys(resourceId(parameters('resourceGroupName'), 'Microsoft.EventHub/namespaces/eventhubs/authorizationRules', parameters('namespace'), parameters('hub'), parameters('ruleName')), '2022-10-01-preview').primaryConnectionString]"
}
}
// ✅ ALTERNATIVE: Use nested deployment outputs for simple values only
"outputs": {
"simpleName": {
"value": "[reference('deploymentName').outputs.nameOutput.value]"
}
}
Cause: Azure CLI bug in versions 2.74.0 and earlier with subscription-level template validation
Solution:
# Update Azure CLI
brew upgrade azure-cli # macOS
# or
apt-get update && apt-get upgrade azure-cli # Linux
Cause: Incorrect scope function or missing resource group parameter
Solution: Match the scope function to deployment level:
resourceId()subscriptionResourceId() or resourceId(resourceGroupName, ...)managementGroupResourceId(){
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"resources": [
{
"type": "Microsoft.Resources/deployments",
"name": "nestedDeployment",
"resourceGroup": "[parameters('resourceGroupName')]",
"properties": {
"mode": "Incremental",
"expressionEvaluationOptions": {
"scope": "inner" // Critical for reference() in nested outputs
},
"template": {
// Inner template deploys to resource group
"outputs": {
"resourceName": {
"value": "[parameters('name')]" // Simple values work
}
}
}
}
}
],
"outputs": {
// Access nested outputs
"name": {
"value": "[reference('nestedDeployment').outputs.resourceName.value]"
},
// Use outputs in other functions - pass as parameters, not nested reference
"connectionString": {
"value": "[listKeys(resourceId(parameters('resourceGroupName'), 'Microsoft.Storage/storageAccounts', parameters('storageName')), '2023-01-01').keys[0].value]"
}
}
}
The Golden Rule: In outputs, DO NOT nest reference() inside listKeys() or resourceId().
Instead:
# Validate subscription-level template
az deployment sub validate \
--location eastus \
--template-file azuredeploy.json \
--parameters @parameters.json
# Validate resource group template
az deployment group validate \
--resource-group myResourceGroup \
--template-file azuredeploy.json \
--parameters @parameters.json
# What-if preview (subscription level)
az deployment sub what-if \
--location eastus \
--template-file azuredeploy.json \
--parameters @parameters.json
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience