Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ManagedServiceIdentity from common-types #605

Closed
Tracked by #583 ...
XiaofeiCao opened this issue Jun 25, 2024 · 0 comments
Closed
Tracked by #583 ...

Support ManagedServiceIdentity from common-types #605

XiaofeiCao opened this issue Jun 25, 2024 · 0 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@XiaofeiCao
Copy link
Contributor

XiaofeiCao commented Jun 25, 2024

Project Setup

Refer to https://github.com/Azure/cadl-ranch/blob/main/README.md for dev setup and PR prep.
Additionally: https://github.com/Azure/cadl-ranch/blob/main/packages/cadl-ranch-specs/README.md

managed-identity definition

https://github.com/Azure/typespec-azure/blob/fe90e201b7ad8bda7f98e786debfae37c025ee98/packages/typespec-azure-resource-manager/lib/common-types/managed-identity.tsp#L13

cadl-ranch-specs folder

put it under: http/azure/arm/models/common-types/managed-identity/main.tsp

usage

model Service is TrackedResource<ServiceProperties> {
  @doc("The name of Azure API Center service.")
  @maxLength(90)
  @minLength(1)
  @pattern("^[a-zA-Z0-9-]{3,90}$")
  @path
  @key("serviceName")
  @segment("services")
  name: string;

  ...ManagedServiceIdentityProperty;
}

https://github.com/Azure/azure-rest-api-specs/blob/44cbf51b9eee8a2dbf55ced61a61032aaed0148b/specification/apicenter/ApiCenter.Management/Service.tsp#L22

Test case

a simple PUT(createOrUpdate) and GET operation should suffice.
https://github.com/Azure/azure-rest-api-specs/blob/44cbf51b9eee8a2dbf55ced61a61032aaed0148b/specification/apicenter/ApiCenter.Management/Service.tsp#L27-L30

Candidate scenario:

  1. Create Resource with SystemAssigned ManagedIdentity only
  2. Update Resource with UserAssigned and SystemAssigned ManagedIdentity
  3. Update Resource with UserAssigned ManagedIdentity only
  4. Get Resource with UserAssigned and SystemAssigned ManagedIdentity

Example

PR for adding test case for TrackedResource, ProxyResource:
#588

main.tsp: https://github.com/Azure/cadl-ranch/blob/main/packages/cadl-ranch-specs/http/azure/arm/models/resources/main.tsp
(We only need one main.tsp for managed-identity, unlike resources, it has toplevel.tsp, etc)

mockapi.ts: https://github.com/Azure/cadl-ranch/blob/main/packages/cadl-ranch-specs/http/azure/arm/models/resources/mockapi.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants