Beispiel #1
0
 /// <summary>
 /// Creates new ResourcesClient instance
 /// </summary>
 /// <param name="resourceManagementClient">The IResourceManagementClient instance</param>
 /// <param name="authorizationManagementClient">The management client instance</param>
 public ResourcesClient(
     IResourceManagementClient resourceManagementClient,
     IAuthorizationManagementClient authorizationManagementClient)
 {
     AuthorizationManagementClient = authorizationManagementClient;
     this.ResourceManagementClient = resourceManagementClient;
 }
Beispiel #2
0
 /// <summary>
 /// Creates new ResourcesClient instance
 /// </summary>
 /// <param name="resourceManagementClient">The IResourceManagementClient instance</param>
 /// <param name="galleryTemplatesClient">The IGalleryClient instance</param>
 /// <param name="authorizationManagementClient">The management client instance</param>
 public ResourcesClient(
     IResourceManagementClient resourceManagementClient,
     GalleryTemplatesClient galleryTemplatesClient,
     IAuthorizationManagementClient authorizationManagementClient)
 {
     GalleryTemplatesClient        = galleryTemplatesClient;
     AuthorizationManagementClient = authorizationManagementClient;
     this.ResourceManagementClient = resourceManagementClient;
 }
 /// <summary>
 /// Creates new ResourcesClient instance
 /// </summary>
 /// <param name="resourceManagementClient">The IResourceManagementClient instance</param>
 /// <param name="galleryTemplatesClient">The IGalleryClient instance</param>
 /// <param name="authorizationManagementClient">The management client instance</param>
 public ResourcesClient(
     IResourceManagementClient resourceManagementClient,
     GalleryTemplatesClient galleryTemplatesClient,
     IAuthorizationManagementClient authorizationManagementClient)
 {
     GalleryTemplatesClient = galleryTemplatesClient;
     AuthorizationManagementClient = authorizationManagementClient;
     this.ResourceManagementClient = resourceManagementClient;
 }
 /// <summary>
 /// Creates new ResourcesClient instance
 /// </summary>
 /// <param name="resourceManagementClient">The IResourceManagementClient instance</param>
 /// <param name="galleryTemplatesClient">The IGalleryClient instance</param>
 /// <param name="eventsClient">The IEventsClient instance</param>
 public ResourcesClient(
     IResourceManagementClient resourceManagementClient,
     GalleryTemplatesClient galleryTemplatesClient,
     IEventsClient eventsClient,
     IAuthorizationManagementClient authorizationManagementClient)
 {
     ResourceManagementClient = resourceManagementClient;
     GalleryTemplatesClient = galleryTemplatesClient;
     EventsClient = eventsClient;
     AuthorizationManagementClient = authorizationManagementClient;
 }
 public ExampleCapture(string secretsFile, string outputFolder, string outputFolderWorkarounds = null)
 {
     this.secrets                 = ExampleHelpers.ReadSecretsFile(secretsFile);
     this.outputFolder            = outputFolder;
     this.outputFolderWorkarounds = outputFolderWorkarounds;
     this.client      = ExampleHelpers.GetRealClient(secrets);
     this.rmClient    = ExampleHelpers.GetRealRmClient(secrets);
     this.authClient  = ExampleHelpers.GetAuthorizationClient(secrets);
     this.interceptor = new ExampleTracingInterceptor(client.SubscriptionId, client.ApiVersion);
     ServiceClientTracing.AddTracingInterceptor(interceptor);
 }
 /// <summary>
 /// Creates new ResourcesClient instance
 /// </summary>
 /// <param name="resourceManagementClient">The IResourceManagementClient instance</param>
 /// <param name="galleryTemplatesClient">The IGalleryClient instance</param>
 /// <param name="eventsClient">The IEventsClient instance</param>
 public ResourcesClient(
     IResourceManagementClient resourceManagementClient,
     GalleryTemplatesClient galleryTemplatesClient,
     IEventsClient eventsClient,
     IAuthorizationManagementClient authorizationManagementClient)
 {
     ResourceManagementClient      = resourceManagementClient;
     GalleryTemplatesClient        = galleryTemplatesClient;
     EventsClient                  = eventsClient;
     AuthorizationManagementClient = authorizationManagementClient;
 }
Beispiel #7
0
 /// <summary>
 /// Creates new ResourcesClient instance
 /// </summary>
 /// <param name="resourceManagementClient">The IResourceManagementClient instance</param>
 /// <param name="galleryTemplatesClient">The IGalleryClient instance</param>
 /// <param name="authorizationManagementClient">The management client instance</param>
 public ResourcesClient(
     IResourceManagementClient resourceManagementClient,
     GalleryTemplatesClient galleryTemplatesClient,
     // TODO: http://vstfrd:8080/Azure/RD/_workitems#_a=edit&id=3247094
     //IEventsClient eventsClient,
     IAuthorizationManagementClient authorizationManagementClient)
 {
     GalleryTemplatesClient = galleryTemplatesClient;
     // TODO: http://vstfrd:8080/Azure/RD/_workitems#_a=edit&id=3247094
     //EventsClient = eventsClient;
     AuthorizationManagementClient = authorizationManagementClient;
     this.ResourceManagementClient = resourceManagementClient;
 }
        /// <summary>
        /// Creates new ResourcesClient instance
        /// </summary>
        /// <param name="resourceManagementClient">The IResourceManagementClient instance</param>
        /// <param name="galleryTemplatesClient">The IGalleryClient instance</param>
        /// <param name="authorizationManagementClient">The management client instance</param>
        public ResourcesClient(
            IResourceManagementClient resourceManagementClient,
#if !NETSTANDARD
            GalleryTemplatesClient galleryTemplatesClient,
#endif
            IAuthorizationManagementClient authorizationManagementClient)
        {
#if !NETSTANDARD
            GalleryTemplatesClient = galleryTemplatesClient;
#endif
            AuthorizationManagementClient = authorizationManagementClient;
            this.ResourceManagementClient = resourceManagementClient;
        }
        public GraphRbacManager(RestClient restClient, string tenantId)
        {
            string graphEndpoint = AzureEnvironment.AzureGlobalCloud.GraphEndpoint;

            if (restClient.Credentials is AzureCredentials)
            {
                graphEndpoint = restClient.Credentials.Environment.GraphEndpoint;
            }
            inner           = GraphRbacManagementClient.NewInstance(graphEndpoint, restClient);
            Inner.TenantID  = tenantId;
            roleInner       = AuthorizationManagementClient.NewInstance(restClient);
            this.tenantId   = tenantId;
            this.restClient = restClient;
        }
Beispiel #10
0
        public GraphRbacManager(RestClient restClient, string tenantId)
        {
            string graphEndpoint = AzureEnvironment.AzureGlobalCloud.GraphEndpoint;

            if (restClient.Credentials is AzureCredentials)
            {
                graphEndpoint = restClient.Credentials.Environment.GraphEndpoint;
            }
            inner = new GraphRbacManagementClient(new Uri(graphEndpoint),
                                                  restClient.Credentials,
                                                  restClient.RootHttpHandler,
                                                  restClient.Handlers.ToArray())
            {
                TenantID = tenantId
            };
            roleInner = new AuthorizationManagementClient(new Uri(restClient.BaseUri),
                                                          restClient.Credentials,
                                                          restClient.RootHttpHandler,
                                                          restClient.Handlers.ToArray());
            this.tenantId   = tenantId;
            this.restClient = restClient;
        }
        public static IAuthorizationManagementClient GetAuthorizationClient(ExampleSecrets secrets)
        {
            IAuthorizationManagementClient client = null;

            if (secrets.Environment == "dogfood")
            {
                string ArmTenant = secrets.TenantId;
                string ArmServicePrincipalIdentity = secrets.ClientId;
                string SubId = secrets.SubId;
                // Use service principal with key to authenticate against Azure
                string secret  = secrets.ClientSecret;
                var    cac     = new ClientCredential(ArmServicePrincipalIdentity, secret);
                var    context = new AuthenticationContext("https://login.windows-ppe.net/" + ArmTenant);
                AuthenticationResult     result = context.AcquireTokenAsync("https://management.core.windows.net/", cac).Result;
                ServiceClientCredentials creds  = new TokenCredentials(result.AccessToken);
                client = new AuthorizationManagementClient(creds)
                {
                    SubscriptionId = secrets.SubId,
                    BaseUri        = new Uri("https://api-dogfood.resources.windows-int.net/")
                };
            }

            return(client);
        }
 /// <summary>
 /// Creates new ResourcesClient instance
 /// </summary>
 /// <param name="resourceManagementClient">The IResourceManagementClient instance</param>
 /// <param name="galleryTemplatesClient">The IGalleryClient instance</param>
 /// <param name="authorizationManagementClient">The management client instance</param>
 public ResourcesClient(
     IResourceManagementClient resourceManagementClient,
     GalleryTemplatesClient galleryTemplatesClient,
     // TODO: http://vstfrd:8080/Azure/RD/_workitems#_a=edit&id=3247094
     //IEventsClient eventsClient,
     IAuthorizationManagementClient authorizationManagementClient)
 {
     GalleryTemplatesClient = galleryTemplatesClient;
     // TODO: http://vstfrd:8080/Azure/RD/_workitems#_a=edit&id=3247094
     //EventsClient = eventsClient;
     AuthorizationManagementClient = authorizationManagementClient;
     this.ResourceManagementClient = resourceManagementClient;
 }