Azure-Samples / Azure-Samples/azure-sdk-for-go-samples
add sample mimicing `az ad sp create-for-rbac`
- Dominant language
- Go
- Stars
- 308
- Forks
- 186
- PR merge metrics
- No merged PRs in 30d
Description
Create a sample which mimics the behavior of `az ad sp create-for-rbac` in Go, as follows:
1. Create a new service principal using [graphrbac][].
2. Create a new role definition using [authorization][].
3. Assign role definition from (2) to principal from (1).
[graphrbac]: https://godoc.org/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac
[authorization]: https://godoc.org/github.com/Azure/azure-sdk-for-go/services/authorization/mgmt/2018-01-01-preview/authorization
Requirements:
* Utilize the **identity of the user currently logged into the az CLI on the local machine** for all operations.
* Demonstrate how to swap the access token from (1), whose audience is `https://graph.windows.net` with one appropriate for (2), whose audience is `https://management.azure.com`.
* Include a busy-wait loop between principal creation and role assignment like the CLI.
Contributor guide
Research direction
Start with the az ad sp create-for-rbac behavior and the linked graphrbac and authorization Go documentation. Build a Go sample using the currently logged-in az CLI identity, covering principal creation, role definition, assignment, audience-specific token swapping, and the requested busy-wait. Done means the sample demonstrates all three operations with both token audiences.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, go
- Domain
- authentication, authorization, cloud
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100