コード例 #1
0
        static void Main(string[] args)
        {
            // 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 if required
            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();
            string defaultDomain = string.Empty;

            foreach (var domain in domains)
            {
                Console.WriteLine(domain.Name);
                if (domain.IsDefault.HasValue && domain.IsDefault.Value == true)
                {
                    defaultDomain = domain.Name;
                }
                // not breaking out of loop on purpose, just to print all domain names if multiple are there.
            }
            string identiferUri = string.Format("https://{0}/myuniqueapp1", defaultDomain);
            var    app          = azure.AccessManagement.ActiveDirectoryApplications
                                  .Define("My Unique App 1")
                                  .WithSignOnUrl("https://myuniqueapp1.azurewebsites.net")
                                  .WithAvailableToOtherTenants(true)
                                  .WithIdentifierUrl(identiferUri)
                                  .DefinePasswordCredential("string")
                                  .WithPasswordValue("string")
                                  .WithDuration(new TimeSpan(365, 0, 0, 0))
                                  .Attach()
                                  .CreateAsync();

            Console.ReadLine();
        }
コード例 #2
0
 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;
 }
コード例 #3
0
 public KeyVaultManager(RestClient restClient, string subscriptionId, string tenantId) :
     base(restClient, subscriptionId, KeyVaultManagementClient.NewInstance(restClient))
 {
     Inner.SubscriptionId = subscriptionId;
     graphRbacManager     = GraphRbacManager.Authenticate(restClient, tenantId);
     this.tenantId        = tenantId;
 }
コード例 #4
0
 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);
 }
コード例 #5
0
 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);
 }
コード例 #6
0
 public KeyVaultManager(RestClient restClient, string subscriptionId, string tenantId) :
     base(restClient, subscriptionId, new KeyVaultManagementClient(restClient)
 {
     SubscriptionId = subscriptionId
 })
 {
     graphRbacManager = GraphRbacManager.Authenticate(restClient, tenantId);
     this.tenantId    = tenantId;
 }
コード例 #7
0
 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);
 }
コード例 #8
0
 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);
 }
コード例 #9
0
 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;
 }
コード例 #10
0
 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);
 }
コード例 #11
0
        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();
        }