Skip to main content

Task 06: Customer Transfer

Implementation Part 7

DOCUMENT CATEGORY: Implementation Runbook
SCOPE: The Azure resources of one Azure Local instance
PURPOSE: Give the customer administrator access in Azure and write the record of the transfer
MASTER REFERENCE: Assign Azure roles using Azure CLI

Status: Active

The script looks the customer administrator up in Microsoft Entra ID (by user principal name, then by mail for a guest), assigns the built-in role Contributor on the resource group and Reader on the subscription when the administrator does not have them, counts the role assignments, and writes the record (Markdown and JSON). It is idempotent: a role the administrator already has is reported, and the script never removes a role assignment. It does not touch the nodes: local access is the customer's decision (a domain group, identity.active_directory.security_groups), and the record says so. It does not sign in.


Values from infrastructure.yml​

The values for this task come from infrastructure.yml (schema 5). Every key, with its type, default and example, is in the variables reference.

KeyWhat the script does with it
cluster.nameThe instance that is handed over (in the record)
azure.tenant_idThe tenant the sign-in must belong to
azure.subscription_id, azure.resource_groupThe scopes of the two role assignments
site.customerThe customer named in the record

The customer's own tenant (-CustomerTenantId) and administrator (-CustomerAdminUPN) are parameters: they are not part of the deployment.


Execution Options​

PowerShell​

When to use: The Az PowerShell modules are installed. Sign in first: Connect-AzAccount -Tenant <azure.tenant_id>, with an account that may create role assignments (Owner or User Access Administrator)

ScriptWhat it does
scripts/deploy/07-validation-handover/task-06-customer-transfer/powershell/Set-CustomerTransfer.ps1Entra lookup, two role assignments, the record. -WhatIf reads Azure, assigns nothing and writes no file
ParameterMeaning
-InfrastructureFileThe infrastructure.yml (schema 5). Required
-CustomerTenantIdThe customer's Entra tenant id (a GUID). It goes in the portal link of the record. Required
-CustomerAdminUPNThe user principal name (or the mail of a guest) of the customer administrator. Required
-OutputPathThe folder for the record. Without it nothing is written
./Set-CustomerTransfer.ps1 -InfrastructureFile ./infrastructure.yml -CustomerTenantId <customer-tenant-id> -CustomerAdminUPN admin@contoso.example -WhatIf
./Set-CustomerTransfer.ps1 -InfrastructureFile ./infrastructure.yml -CustomerTenantId <customer-tenant-id> -CustomerAdminUPN admin@contoso.example -OutputPath ./handover

Exit codes (both): 0 the transfer is in place (assigned, already there, or planned under -WhatIf) and the record is written; 1 an Azure call failed or a precondition failed (not signed in, wrong tenant, the administrator not found, an assignment failed), or (Azure CLI) the earlier subscription could not be put back; 2 a value in the file or a parameter is missing or not usable.


Validation​

  • Exit code 0 and both roles are Assigned or AlreadyAssigned
  • The customer administrator sees the resource group in the Azure portal (the link is in the record)
  • The record is saved with the rest of the handover package

Troubleshooting​

IssueCauseResolution
was not found in Microsoft Entra IDA guest has not been invited, or the name is wrongInvite the guest first, then run again
An assignment fails with AuthorizationFailedThe signed-in account cannot create role assignmentsSign in as Owner or User Access Administrator
Signed in to the wrong tenantaz or Connect-AzAccount is in another tenantSign in to azure.tenant_id

PreviousUpNext
Task 05: Deployment DocumentationPart 7 IndexPart 8: Day 2 Operations

Version Control​

VersionDateAuthorChanges
1.0.02026-11-15Azure Local CloudInitial release (the script moved here from the old handover folder of the toolkit; adds the Azure CLI script)
1.0.12026-11-16Azure Local CloudAzure CLI tab: the argument guard, an apostrophe in the address, exit code 1 when the earlier subscription cannot be put back