public Authenticated(RestClient restClient, string tenantId) { this.restClient = restClient; resourceManagerAuthenticated = ResourceManager.Fluent.ResourceManager.Authenticate(this.restClient); graphRbacManager = GraphRbacManager.Authenticate(this.restClient, tenantId); this.tenantId = tenantId; }
private ContainerInstanceManager(RestClient restClient, string subscriptionId) : base(restClient, subscriptionId, ContainerInstanceManagementClient.NewInstance(restClient)) { Inner.SubscriptionId = subscriptionId; this.storageManager = StorageManager.Authenticate(restClient, subscriptionId); this.rbacManager = GraphRbacManager.Authenticate(restClient, subscriptionId); }
public static IGraphRbacManager CreateGraphRbacManager() { return(CreateMockedManager(c => GraphRbacManager .Configure() .WithDelegatingHandlers(GetHandlers()) .WithLogLevel(HttpLoggingDelegatingHandler.Level.BodyAndHeaders) .Authenticate(c, c.TenantId))); }
public ComputeManager(RestClient restClient, string subscriptionId) : base(restClient, subscriptionId, ComputeManagementClient.NewInstance(restClient)) { Inner.SubscriptionId = subscriptionId; storageManager = StorageManager.Authenticate(restClient, subscriptionId); networkManager = NetworkManager.Authenticate(restClient, subscriptionId); rbacManager = GraphRbacManager.Authenticate(restClient, restClient.Credentials.TenantId); }
public KeyVaultManager(RestClient restClient, string subscriptionId, string tenantId) : base(restClient, subscriptionId, new KeyVaultManagementClient(restClient) { SubscriptionId = subscriptionId }) { graphRbacManager = GraphRbacManager.Authenticate(restClient, tenantId); this.tenantId = tenantId; }
private ContainerInstanceManager(RestClient restClient, string subscriptionId) : base(restClient, subscriptionId, new ContainerInstanceManagementClient(restClient) { SubscriptionId = subscriptionId }) { this.storageManager = StorageManager.Authenticate(restClient, subscriptionId); this.rbacManager = GraphRbacManager.Authenticate(restClient, subscriptionId); }
public ComputeManager(RestClient restClient, string subscriptionId) : base(restClient, subscriptionId, new ComputeManagementClient(restClient) { SubscriptionId = subscriptionId }) { storageManager = StorageManager.Authenticate(restClient, subscriptionId); networkManager = NetworkManager.Authenticate(restClient, subscriptionId); rbacManager = GraphRbacManager.Authenticate(restClient, restClient.Credentials.TenantId); }
public KeyVaultManager(RestClient restClient, string subscriptionId, string tenantId) : base(restClient, subscriptionId, new KeyVaultManagementClient(new Uri(restClient.BaseUri), restClient.Credentials, restClient.RootHttpHandler, restClient.Handlers.ToArray()) { SubscriptionId = subscriptionId }) { graphRbacManager = GraphRbacManager.Authenticate(restClient, tenantId); this.tenantId = tenantId; }
public ComputeManager(RestClient restClient, string subscriptionId) : base(restClient, subscriptionId, new ComputeManagementClient(new Uri(restClient.BaseUri), restClient.Credentials, restClient.RootHttpHandler, restClient.Handlers.ToArray()) { SubscriptionId = subscriptionId }) { storageManager = StorageManager.Authenticate(restClient, subscriptionId); networkManager = NetworkManager.Authenticate(restClient, subscriptionId); rbacManager = GraphRbacManager.Authenticate(restClient, ((AzureCredentials)(restClient.Credentials)).TenantId); }
/// <summary> /// https://blogs.msdn.microsoft.com/premier_developer/2017/09/29/getting-started-with-the-azure-ad-b2b-invite-api/ /// </summary> /// <param name="userPrincipalName"></param> /// <returns></returns> private async Task <string> EnsureAzureADGuestUserExists(string userDisplayName, string userEmailAddress, string redirectUri) { var client = RestClient .Configure() .WithEnvironment(AzureEnvironment.AzureGlobalCloud) .WithLogLevel(HttpLoggingDelegatingHandler.Level.None) .WithCredentials(_authenticationHelper.GetAzureCrendentials()) .Build(); GraphRbacManager graphRbacManager = new GraphRbacManager(client, _appSettings.TenantId); IActiveDirectoryUser user = await graphRbacManager.Users.GetByNameAsync(userDisplayName); if (user == null) { return(await InviteUser(userDisplayName, userEmailAddress, redirectUri)); } else { return(user.Id); } }
static void Main(string[] args) { // azure variable here is just for reference.. I'm not really using it further. // it's just to show that whatever method you're using already for Authentication (like through file or with credentials or with cert // same can be used to get AzureCredentials as well, just change the FromFile to FromServicePrincipal.. IAzure azure = Azure.Authenticate("my.azureauth").WithDefaultSubscription(); var creds = SdkContext.AzureCredentialsFactory.FromFile("my.azureauth"); IGraphRbacManager graphRbacManager = GraphRbacManager.Authenticate(creds, "<your tenant Guid>"); var domains = graphRbacManager.Inner.Domains.ListAsync().GetAwaiter().GetResult(); // I'm just looping through and displaying on console.. // but you will make use of one of these to form identifierURI.. foreach (var domain in domains) { // also look at isDefault and isVerified properties if they help you Console.WriteLine(domain.Name); } Console.ReadLine(); }