Scenario 1: Role Assignment Flags with --infra-json (--assign-service-principal-roles)

Objective: Verify that combining --assign-service-principal-roles with --infra-json on create cluster azure returns a clear error instead of silently skipping role assignment.

Result: PASS — Command exits non-zero with clear error message guiding user to the correct workflow.

Command

$ hypershift create cluster azure \
    --name test-s1 \
    --azure-creds creds.yaml \
    --infra-json infra.json \
    --assign-service-principal-roles \
    --dns-zone-rg-name my-dns-rg \
    --pull-secret pull-secret.json \
    --release-image quay.io/openshift-release-dev/ocp-release:4.18.0-x86_64 \
    --workload-identities-file wi.json \
    --render --render-into /dev/null

Full Output

{"level":"error","ts":"2026-06-17T10:30:17-04:00","msg":"Failed to create cluster","error":"role assignment flags cannot be used with --infra-json; use --assign-identity-roles on 'create infra azure' instead","stacktrace":"github.com/openshift/hypershift/cmd/cluster/azure.NewCreateCommand.func1
	/Users/brcox/bryan-cox/hypershift_ws/hypershift-worktrees/OCPBUGS-84239/cmd/cluster/azure/create.go:64
github.com/spf13/cobra.(*Command).execute
	/Users/brcox/bryan-cox/hypershift_ws/hypershift-worktrees/OCPBUGS-84239/vendor/github.com/spf13/cobra/command.go:1015
github.com/spf13/cobra.(*Command).ExecuteC
	/Users/brcox/bryan-cox/hypershift_ws/hypershift-worktrees/OCPBUGS-84239/vendor/github.com/spf13/cobra/command.go:1148
github.com/spf13/cobra.(*Command).Execute
	/Users/brcox/bryan-cox/hypershift_ws/hypershift-worktrees/OCPBUGS-84239/vendor/github.com/spf13/cobra/command.go:1071
github.com/spf13/cobra.(*Command).ExecuteContext
	/Users/brcox/bryan-cox/hypershift_ws/hypershift-worktrees/OCPBUGS-84239/vendor/github.com/spf13/cobra/command.go:1064
main.main
	/Users/brcox/bryan-cox/hypershift_ws/hypershift-worktrees/OCPBUGS-84239/main.go:80
runtime.main
	/opt/homebrew/Cellar/go/1.26.0/libexec/src/runtime/proc.go:290"}
Error: role assignment flags cannot be used with --infra-json; use --assign-identity-roles on 'create infra azure' instead
role assignment flags cannot be used with --infra-json; use --assign-identity-roles on 'create infra azure' instead

Exit code: 1

Verification

CheckResult
Command exits with non-zero codePASS — Exit code: 1
Error message mentions incompatibilityPASSrole assignment flags cannot be used with --infra-json
Error message guides user to correct workflowPASSuse --assign-identity-roles on 'create infra azure' instead
← Dashboard Scenario 2 →