Bird
Raised Fist0
Azurecloud~10 mins

Blueprint for environment setup in Azure - Interactive Code Practice

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a blueprint artifact type.

Azure
artifact = {
  'type': '[1]'
}
Drag options to blanks, or click blank then click option'
AroleAssignment
BpolicyAssignment
Ctemplate
DresourceGroup
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 'template' instead of 'policyAssignment'.
2fill in blank
medium

Complete the code to assign a role in the blueprint definition.

Azure
role_assignment = {
  'type': 'roleAssignment',
  'roleDefinitionId': '[1]'
}
Drag options to blanks, or click blank then click option'
A/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleDefinitions/{roleId}
B/subscriptions/{subscriptionId}/resourceGroups/{rgName}
C/providers/Microsoft.Blueprint/blueprints/{blueprintName}
D/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}
Attempts:
3 left
💡 Hint
Common Mistakes
Using resource group or deployment paths instead of role definition ID.
3fill in blank
hard

Fix the error in the blueprint assignment command to specify the correct scope.

Azure
az blueprint assignment create --name myAssignment --blueprint-name myBlueprint --subscription [1]
Drag options to blanks, or click blank then click option'
AmyResourceGroup
BmyTenantId
CmySubscriptionId
DmyManagementGroup
Attempts:
3 left
💡 Hint
Common Mistakes
Using resource group name instead of subscription ID.
4fill in blank
hard

Fill both blanks to define a blueprint artifact with a resource group and a template.

Azure
{
  'artifacts': [
    {
      'name': 'storageRG',
      'type': '[1]',
      'resourceGroup': {
        'name': '[2]'
      }
    }
  ]
}
Drag options to blanks, or click blank then click option'
AresourceGroup
BpolicyAssignment
CstorageAccount
Dtemplate
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing artifact type with resource names.
5fill in blank
hard

Fill all three blanks to create a blueprint assignment with a name, location, and subscription scope.

Azure
az blueprint assignment create --name [1] --location [2] --subscription [3] --blueprint-name myBlueprint
Drag options to blanks, or click blank then click option'
AprodAssignment
Beastus
C12345678-1234-1234-1234-123456789abc
Dwestus
Attempts:
3 left
💡 Hint
Common Mistakes
Using region names for subscription or vice versa.

Practice

(1/5)
1. What is the main purpose of an Azure Blueprint in environment setup?
easy
A. To monitor resource usage and billing
B. To manually configure each resource individually
C. To automate and standardize the deployment of Azure resources
D. To create virtual machines only

Solution

  1. Step 1: Understand the role of Azure Blueprints

    Azure Blueprints help automate and standardize how environments are set up by defining a repeatable set of resources and policies.
  2. Step 2: Compare options with blueprint purpose

    Options A, B, and D describe manual configuration, monitoring, or limited resource creation, which are not the main goals of Blueprints.
  3. Final Answer:

    To automate and standardize the deployment of Azure resources -> Option C
  4. Quick Check:

    Blueprints automate setup = C [OK]
Hint: Blueprints automate setup, not manual or monitoring tasks [OK]
Common Mistakes:
  • Confusing Blueprints with monitoring tools
  • Thinking Blueprints only create VMs
  • Assuming manual setup is automated by Blueprints
2. Which Azure CLI command is used to publish a blueprint after creation?
easy
A. az blueprint create
B. az blueprint publish
C. az blueprint assign
D. az blueprint delete

Solution

  1. Step 1: Identify the command to publish a blueprint

    The command az blueprint publish is used to publish a blueprint version after it is created.
  2. Step 2: Differentiate from other commands

    az blueprint create creates a blueprint, az blueprint assign assigns it to a subscription, and az blueprint delete removes it.
  3. Final Answer:

    az blueprint publish -> Option B
  4. Quick Check:

    Publish blueprint = az blueprint publish [OK]
Hint: Publish blueprints with 'az blueprint publish' command [OK]
Common Mistakes:
  • Using 'create' instead of 'publish' to finalize blueprint
  • Confusing 'assign' with 'publish'
  • Trying to delete instead of publish
3. Given this Azure CLI snippet:
az blueprint create --name MyBlueprint --description "Test blueprint" --subscription 12345
az blueprint artifact resource-group add --blueprint-name MyBlueprint --resource-group-name MyRG --subscription 12345
az blueprint publish --name MyBlueprint --subscription 12345
az blueprint assign --name MyBlueprint --subscription 12345

What is the expected result after running these commands?
medium
A. A blueprint named MyBlueprint is created, published, and assigned, deploying resource group MyRG
B. Only the blueprint is created but not published or assigned
C. The resource group MyRG is created but blueprint is not assigned
D. An error occurs because resource group cannot be added as artifact

Solution

  1. Step 1: Analyze each command's effect

    The commands create a blueprint, add a resource group artifact, publish the blueprint, and assign it to the subscription.
  2. Step 2: Understand blueprint assignment behavior

    Assigning the blueprint deploys the defined artifacts, so resource group MyRG will be created in the subscription.
  3. Final Answer:

    A blueprint named MyBlueprint is created, published, and assigned, deploying resource group MyRG -> Option A
  4. Quick Check:

    Blueprint create + publish + assign deploys artifacts = D [OK]
Hint: Assigning blueprint deploys all defined artifacts automatically [OK]
Common Mistakes:
  • Assuming blueprint must be manually deployed after assignment
  • Thinking resource group cannot be an artifact
  • Missing publish step effect
4. You run this command to assign a blueprint:
az blueprint assign --name MyBlueprint --subscription 12345

But you get an error saying the blueprint is not published. What is the likely fix?
medium
A. Run az blueprint publish --name MyBlueprint --subscription 12345 before assigning
B. Delete and recreate the blueprint
C. Assign the blueprint without specifying subscription
D. Use az blueprint create again to fix

Solution

  1. Step 1: Understand blueprint lifecycle

    A blueprint must be published before it can be assigned to a subscription.
  2. Step 2: Identify the missing step

    The error indicates the blueprint was created but not published, so publishing it first resolves the issue.
  3. Final Answer:

    Run az blueprint publish --name MyBlueprint --subscription 12345 before assigning -> Option A
  4. Quick Check:

    Publish blueprint before assign = B [OK]
Hint: Always publish blueprint before assignment to avoid errors [OK]
Common Mistakes:
  • Skipping publish step
  • Recreating blueprint unnecessarily
  • Ignoring subscription parameter
5. You want to enforce a policy that all resource groups created by your blueprint must have tags for 'Environment' and 'Owner'. How should you include this in your Azure Blueprint?
hard
A. Use a script artifact to delete resource groups without tags
B. Manually add tags after resource groups are deployed
C. Create resource groups outside the blueprint with tags and assign blueprint later
D. Add a policy artifact to the blueprint that requires these tags on resource groups

Solution

  1. Step 1: Understand policy artifacts in blueprints

    Policy artifacts enforce rules like requiring tags on resources during deployment.
  2. Step 2: Apply policy to resource groups in blueprint

    Adding a policy artifact that requires 'Environment' and 'Owner' tags ensures compliance automatically when resource groups are created.
  3. Step 3: Evaluate other options

    Manual tagging or scripts are error-prone and not automated; creating resource groups outside blueprint defeats standardization.
  4. Final Answer:

    Add a policy artifact to the blueprint that requires these tags on resource groups -> Option D
  5. Quick Check:

    Use policy artifact to enforce tags = A [OK]
Hint: Use policy artifacts in blueprint to enforce tagging rules [OK]
Common Mistakes:
  • Relying on manual tagging after deployment
  • Not using policy artifacts for enforcement
  • Creating resources outside blueprint control