-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Supporting subscriptionTenantId and managementGroupId in SubscriptionClient.Alias.CreateAsync() Request #25723
Comments
Thank you for your feedback. Tagging and routing to the team member best able to assist. |
string clientId = "";
string clientSecret = "";
string tenantId = "";
// get token
ClientCredential cc = new ClientCredential(clientId, clientSecret);
var context = new AuthenticationContext("https://login.microsoftonline.com/" + tenantId);
var result = context.AcquireTokenAsync("https://management.azure.com/", cc);
string AccessToken = result.Result.AccessToken;
var bauthCredentials = new TokenCredentials(AccessToken);
ServiceClientCredentials credentials = bauthCredentials;
DelegatingHandler[] handlers = new DelegatingHandler[] { };
// create SubscriptionClient
SubscriptionClient client = new SubscriptionClient(bauthCredentials, handlers);
client.SetRetryPolicy(new RetryPolicy<HttpStatusCodeErrorDetectionStrategy>(1));
// create new Subscription
const string aliasName = "navyprod1";
var putAliasRequest = new PutAliasRequest()
{
Properties = new PutAliasRequestProperties()
{
DisplayName = "TestSub",
Workload = Workload.Production,
BillingScope = "/providers/Microsoft.Billing/billingAccounts/4756419/enrollmentAccounts/224190"
}
};
var subscriptionResult = client.Alias.CreateWithHttpMessagesAsync(aliasName, putAliasRequest).ConfigureAwait(false).GetAwaiter().GetResult();
Console.WriteLine(subscriptionResult.Response.StatusCode);
Console.WriteLine(subscriptionResult);
Console.WriteLine(subscriptionResult.Body.Properties.SubscriptionId); More information: source code test sample |
Hi @dvbb thanks for the comment, however, I need to create them into a specific and different tenant. that is only available via that private preview API. |
Hi @jujinfu The API This issue will route to the service team. |
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @anuragdalmia, @ShilpiGautam, @ramaganesan-rg. Issue DetailsLibrary nameMicrosoft.Azure.Management.Subscription Please describe the feature.In the Azure UI, we already can request subscriptions to be created under a different tenant with payload of We would like to use this in our production API
|
Hey @jujinfu We have officially released the GA version (2021-10-01) of API which supports tenant id & management group Id, yes this is good to use for production scenarios. https://docs.microsoft.com/en-us/rest/api/subscription/2021-10-01/alias/create |
@veathipa thank you so much for the exciting news. We will try it out soon! |
@veathipa If I provision a subscription in a different tenant and set a user as owner, it will send an email to ask user to accept. If I provision a subscription in a different tenant, and set a service principal as owner, it still tries to send an email to accept. I think we are good now and this working at lease. Thank you again! |
Library name
Microsoft.Azure.Management.Subscription
Please describe the feature.
In the Azure UI, we already can request subscriptions to be created under a different tenant
we see API calls being made to
https://management.azure.com/providers/Microsoft.Subscription/aliases/{subId}?api-version=2021-01-01-privatepreview
with payload of
{additionalProperties: {managementGroupId: "", subscriptionTenantId: "{tenantId}",…} billingScope: "{billingScope}" displayName: "subscription-5" resellerId: null workLoad: "Production"}
We would like to use this in our production API
The text was updated successfully, but these errors were encountered: