azure-sdk-for-python icon indicating copy to clipboard operation
azure-sdk-for-python copied to clipboard

Support for multi-tenant shared gallery images

Open gsimore opened this issue 6 years ago • 18 comments

Is your feature request related to a problem? Please describe.

  • When someone shares an image with me from a shared image gallery, it's frustrating that the only way to provision a VM with those is through the Azure CLI or Powershell, when I would like to be using Python.
  • It's frustrating to have to manage credentials and authenticate across multiple tenants to list all of the shared gallery images available to me from other subscriptions and tenants. I don't even know if listing is possible from all sources today.

Describe the solution you'd like

  • I would like to be able to list all shared gallery images that I have access to, whether they are from another tenant, another subscription, etc. within the same API call.
  • I would like to be able to provision VMs using those shared gallery images from across tenants using the Python SDK.

Describe alternatives you've considered There doesn't seem to be a workaround.

Additional context I have a limited understanding of how Azure tenants / subscriptions and sharing works across those, so please excuse my lack of knowledge and feel free to clarify anything for me.

gsimore avatar Jan 22 '20 00:01 gsimore

It turns out we don't need to support multi-tenant after all (phew), just multiple subscription sharing on one tenant.

gsimore avatar Jan 23 '20 01:01 gsimore

@gsimore Thanks for opening this issue. We'll follow up with you after we take a look at the feature request.

nickzhums avatar Jan 23 '20 03:01 nickzhums

We don't support multi-subscription operation for now.

Hi @Abyssknight , help to give an example for how to go through multiple subscription

changlong-liu avatar Jun 23 '20 03:06 changlong-liu

We were able to solve our issue by first calling the subscription client to list all subscriptions available to the tenant, then instantiating a new client for each one, and calling into the galleries api to list all shared gallery images available to each subscription.

gsimore avatar Jun 23 '20 17:06 gsimore

We were able to solve our issue by first calling the subscription client to list all subscriptions available to the tenant, then instantiating a new client for each one, and calling into the galleries api to list all shared gallery images available to each subscription.

@gsimore can you please share some sample code which you tried..we have same use case, it will be helpful

onenessboy avatar Aug 25 '20 06:08 onenessboy

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Drewm3, @avirishuv.

ghost avatar Aug 25 '20 06:08 ghost

Hi compute team, would have a look at this? multi-tenant shared gallery images query interfaces is expected.

changlong-liu avatar Aug 25 '20 06:08 changlong-liu

Hi compute team, would have a look at this? multi-tenant shared gallery images query interfaces is expected.

@changlong-liu would llike to see if you any existing python sdk example to achieve this. It will be helpful

onenessboy avatar Aug 25 '20 09:08 onenessboy

any update on this please

onenessboy avatar Sep 10 '20 14:09 onenessboy

Hi @onenessboy , no existing SDK doing this. Need to list all subscriptions and then query gallery images one by one.

list subscription like this:

from azure.mgmt.resource import  SubscriptionClient
client = SubscriptionClient(credentials=credential)
for sub in client.subscriptions.list():
    print(sub.subscription_id)

changlong-liu avatar Sep 11 '20 03:09 changlong-liu

@changlong-liu There are two issues here:

  1. List all galleries (within and from other tenants) that a user has access to using Python SDK. I'm checking whether its possible with API today.
  2. Deploy VMs from shared image gallery images from other tenants using Python SDK. This is possible today with API, CLI, PowerShell etc., but seems like Python SDK doesn't support it. We might want to check if Python SDK supports auxiliary tokens - if they do, cross tenant scenarios will be achievable.

axayjo avatar Sep 24 '20 21:09 axayjo

Hi @axayjo ,

Would you suggest which RESTFUL API can achieve across tenant gallery operations? Is it defined in the azure-rest-api-specs repo?

The gallery related Python SDK operations are generated from this swagger file: https://github.com/Azure/azure-rest-api-specs/blob/master/specification/compute/resource-manager/Microsoft.Compute/stable/2019-12-01/gallery.json I don't see interfaces for listing all galeries/deploy images across tenants exposed in that file.

changlong-liu avatar Sep 25 '20 01:09 changlong-liu

Hi @changlong-liu

I'm looking at the listing capability on the API side.

The #2 in my earlier comment was around Python SDK support for cross tenant scenarios in general that requires an auxiliary token - is that supported?

axayjo avatar Sep 28 '20 21:09 axayjo

Hi @axayjo , would you help indicate how CLI support cross tenant? I can then check the corresponding Python SDK behavior?.

changlong-liu avatar Oct 19 '20 08:10 changlong-liu

Adding @amjads1 and removing @axayjo

avirishuv avatar Nov 09 '21 23:11 avirishuv

Apologies for the delay, looking into the issue.

amjads1 avatar Dec 08 '21 08:12 amjads1

Hi @gsimore. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text “/unresolve” to remove the “issue-addressed” label and continue the conversation.

ghost avatar Dec 15 '21 08:12 ghost

Hi @gsimore, since you haven’t asked that we “/unresolve” the issue, we’ll close this out. If you believe further discussion is needed, please add a comment “/unresolve” to reopen the issue.

ghost avatar Dec 27 '21 10:12 ghost