• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Models.AzureSubscription类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Microsoft.Azure.Common.Authentication.Models.AzureSubscription的典型用法代码示例。如果您正苦于以下问题:C# AzureSubscription类的具体用法?C# AzureSubscription怎么用?C# AzureSubscription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AzureSubscription类属于Microsoft.Azure.Common.Authentication.Models命名空间,在下文中一共展示了AzureSubscription类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: IsStorageServiceAvailable

 public bool IsStorageServiceAvailable(AzureSubscription subscription, string name)
 {
     EnsureCloudServiceClientInitialized(subscription);
     bool available = this.CloudServiceClient.CheckStorageServiceAvailability(name);
     WriteObject(!available);
     return available;
 }
开发者ID:docschmidt,项目名称:azure-powershell,代码行数:7,代码来源:TestAzureName.cs


示例2: AzureSqlDatabaseAdapter

 /// <summary>
 /// Constructs a database adapter
 /// </summary>
 /// <param name="profile">The current azure profile</param>
 /// <param name="subscription">The current azure subscription</param>
 public AzureSqlDatabaseAdapter(AzureProfile Profile, AzureSubscription subscription)
 {
     this.Profile = Profile;
     this._subscription = subscription;
     Communicator = new AzureSqlDatabaseCommunicator(Profile, subscription);
     ElasticPoolCommunicator = new AzureSqlElasticPoolCommunicator(Profile, subscription);
 }
开发者ID:shuainie,项目名称:azure-powershell,代码行数:12,代码来源:AzureSqlDatabaseAdapter.cs


示例3: WebsitesClient

 /// <summary>
 /// Creates new WebsitesClient
 /// </summary>
 /// <param name="subscription">Subscription containing websites to manipulate</param>
 /// <param name="logger">The logger action</param>
 public WebsitesClient(AzureProfile profile, AzureSubscription subscription, Action<string> logger)
 {
     Logger = logger;
     cloudServiceClient = new CloudServiceClient(profile, subscription, debugStream: logger);
     WebsiteManagementClient = AzureSession.ClientFactory.CreateClient<WebSiteManagementClient>(profile, subscription, AzureEnvironment.Endpoint.ServiceManagement);
     this.subscription = subscription;
 }
开发者ID:pelagos,项目名称:azure-powershell,代码行数:12,代码来源:WebsitesClient.cs


示例4: DisableAzureWebsiteApplicationDiagnosticApplication

        public void DisableAzureWebsiteApplicationDiagnosticApplication()
        {
            // Setup
            websitesClientMock.Setup(f => f.DisableApplicationDiagnostic(
                websiteName,
                WebsiteDiagnosticOutput.FileSystem, null));

            disableAzureWebsiteApplicationDiagnosticCommand = new DisableAzureWebsiteApplicationDiagnosticCommand()
            {
                CommandRuntime = commandRuntimeMock.Object,
                Name = websiteName,
                WebsitesClient = websitesClientMock.Object,
                File = true,
            };

            currentProfile = new AzureProfile();
            var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
            subscription.Properties[AzureSubscription.Property.Default] = "True";
            currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription;

            // Test
            disableAzureWebsiteApplicationDiagnosticCommand.ExecuteCmdlet();

            // Assert
            websitesClientMock.Verify(f => f.DisableApplicationDiagnostic(
                websiteName,
                WebsiteDiagnosticOutput.FileSystem, null), Times.Once());

            commandRuntimeMock.Verify(f => f.WriteObject(true), Times.Never());
        }
开发者ID:shuainie,项目名称:azure-powershell,代码行数:30,代码来源:DisableAzureWebsiteDiagnosticTests.cs


示例5: SetupEnvironment

        /// <summary>
        /// This overrides the default subscription and default account. This allows the 
        /// test to get the tenant id in the test.
        /// </summary>
        public void SetupEnvironment()
        {
            base.SetupEnvironment(AzureModule.AzureResourceManager);

            TestEnvironment csmEnvironment = new CSMTestEnvironmentFactory().GetTestEnvironment();

            if (csmEnvironment.SubscriptionId != null)
            {
                //Overwrite the default subscription and default account
                //with ones using user ID and tenant ID from auth context
                var user = GetUser(csmEnvironment);
                var tenantId = GetTenantId(csmEnvironment);

                // Existing test will not have a user or tenant id set
                if (tenantId != null && user != null)
                {
                    var testSubscription = new AzureSubscription()
                    {
                        Id = new Guid(csmEnvironment.SubscriptionId),
                        Name = AzureRmProfileProvider.Instance.Profile.Context.Subscription.Name,
                        Environment = AzureRmProfileProvider.Instance.Profile.Context.Subscription.Environment,
                        Account = user,
                        Properties = new Dictionary<AzureSubscription.Property, string>
                    {
                        {
                            AzureSubscription.Property.Default, "True"
                        },
                        {
                            AzureSubscription.Property.StorageAccount,
                            Environment.GetEnvironmentVariable("AZURE_STORAGE_ACCOUNT")
                        },
                        {
                            AzureSubscription.Property.Tenants, tenantId
                        },
                    }
                    };

                    var testAccount = new AzureAccount()
                    {
                        Id = user,
                        Type = AzureAccount.AccountType.User,
                        Properties = new Dictionary<AzureAccount.Property, string>
                    {
                        {
                            AzureAccount.Property.Subscriptions, csmEnvironment.SubscriptionId
                        },
                    }
                    };

                    AzureRmProfileProvider.Instance.Profile.Context.Subscription.Name = testSubscription.Name;
                    AzureRmProfileProvider.Instance.Profile.Context.Subscription.Id = testSubscription.Id;
                    AzureRmProfileProvider.Instance.Profile.Context.Subscription.Account = testSubscription.Account;

                    var environment = AzureRmProfileProvider.Instance.Profile.Environments[AzureRmProfileProvider.Instance.Profile.Context.Subscription.Environment];
                    environment.Endpoints[AzureEnvironment.Endpoint.Graph] = csmEnvironment.Endpoints.GraphUri.AbsoluteUri;
                    environment.Endpoints[AzureEnvironment.Endpoint.StorageEndpointSuffix] = "core.windows.net"; 
                    AzureRmProfileProvider.Instance.Profile.Save();
                }
            }
        }
开发者ID:docschmidt,项目名称:azure-powershell,代码行数:64,代码来源:SqlEvnSetupHelper.cs


示例6: ListWebHostingPlansTest

        public void ListWebHostingPlansTest()
        {
            // Setup
            var clientMock = new Mock<IWebsitesClient>();
            clientMock.Setup(c => c.ListWebSpaces())
                .Returns(new[] {new WebSpace {Name = "webspace1"}, new WebSpace {Name = "webspace2"}});

            clientMock.Setup(c => c.ListWebHostingPlans())
                .Returns(new List<WebHostingPlan>
                {
                    new WebHostingPlan {Name = "Plan1", WebSpace = "webspace1"},
                    new WebHostingPlan { Name = "Plan2", WebSpace = "webspace2" }
                });
             
            // Test
            var command = new GetAzureWebHostingPlanCommand
            {
                CommandRuntime = new MockCommandRuntime(),
                WebsitesClient = clientMock.Object
            };
            currentProfile = new AzureProfile();
            var subscription = new AzureSubscription{Id = new Guid(subscriptionId) };
            subscription.Properties[AzureSubscription.Property.Default] = "True";
            currentProfile.Subscriptions[new Guid(subscriptionId)] = subscription;

            command.ExecuteCmdlet();

            var plans = System.Management.Automation.LanguagePrimitives.GetEnumerable(((MockCommandRuntime)command.CommandRuntime).OutputPipeline).Cast<WebHostingPlan>();

            Assert.NotNull(plans);
            Assert.Equal(2, plans.Count());
            Assert.True(plans.Any(p => (p).Name.Equals("Plan1") && (p).WebSpace.Equals("webspace1")));
            Assert.True(plans.Any(p => (p).Name.Equals("Plan2") && (p).WebSpace.Equals("webspace2")));
        }
开发者ID:shuainie,项目名称:azure-powershell,代码行数:34,代码来源:GetAzureWebHostingPlanTests.cs


示例7: ProcessShowWebsiteTest

        public void ProcessShowWebsiteTest()
        {
            // Setup
            var mockClient = new Mock<IWebsitesClient>();
            mockClient.Setup(c => c.GetWebsite("website1", null))
                .Returns(new Site
                {
                    Name = "website1",
                    WebSpace = "webspace1",
                    HostNames = new[] {"website1.cloudapp.com"}
                });

            // Test
            ShowAzureWebsiteCommand showAzureWebsiteCommand = new ShowAzureWebsiteCommand
            {
                CommandRuntime = new MockCommandRuntime(),
                Name = "website1",
                WebsitesClient = mockClient.Object
            };
            currentProfile = new AzureSMProfile();
            var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
            subscription.Properties[AzureSubscription.Property.Default] = "True";
            currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription;

            // Show existing website
            showAzureWebsiteCommand.ExecuteCmdlet();
        }
开发者ID:docschmidt,项目名称:azure-powershell,代码行数:27,代码来源:ShowAzureWebsiteTests.cs


示例8: RestartsWebsiteSlot

        public void RestartsWebsiteSlot()
        {
            // Setup
            const string websiteName = "website1";
            const string slot = "staging";

            Mock<IWebsitesClient> websitesClientMock = new Mock<IWebsitesClient>();
            websitesClientMock.Setup(f => f.RestartWebsite(websiteName, slot));

            // Test
            RestartAzureWebsiteCommand restartAzureWebsiteCommand = new RestartAzureWebsiteCommand()
            {
                CommandRuntime = new MockCommandRuntime(),
                Name = websiteName,
                WebsitesClient = websitesClientMock.Object,
                Slot = slot
            };
            currentProfile = new AzureSMProfile();
            var subscription = new AzureSubscription{Id = new Guid(base.subscriptionId) };
            subscription.Properties[AzureSubscription.Property.Default] = "True";
            currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription;

            restartAzureWebsiteCommand.ExecuteCmdlet();

            websitesClientMock.Verify(f => f.RestartWebsite(websiteName, slot), Times.Once());
        }
开发者ID:docschmidt,项目名称:azure-powershell,代码行数:26,代码来源:RestartAzureWebsiteTests.cs


示例9: GetCurrentSubscription

        public static AzureSubscription GetCurrentSubscription()
        {
            string certificateThumbprint1 = "jb245f1d1257fw27dfc402e9ecde37e400g0176r";
            var newSubscription = new AzureSubscription()
            {
                Id = IntegrationTestBase.TestCredentials.SubscriptionId,
                // Use fake certificate thumbprint
                Account = certificateThumbprint1,
                Environment = "AzureCloud"
            };
            newSubscription.Properties[AzureSubscription.Property.Default] = "True";

            ProfileClient profileClient = new ProfileClient(new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile)));
            profileClient.Profile.Accounts[certificateThumbprint1] = 
                new AzureAccount()
                {
                    Id = certificateThumbprint1,
                    Type = AzureAccount.AccountType.Certificate
                };
            profileClient.Profile.Subscriptions[newSubscription.Id] = newSubscription;
            
            profileClient.Profile.Save();
            
            return profileClient.Profile.Subscriptions[newSubscription.Id];
        }
开发者ID:shuainie,项目名称:azure-powershell,代码行数:25,代码来源:IntegrationTestBase.cs


示例10: ExecuteCmdlet

        public override void ExecuteCmdlet()
        {
            switch (ParameterSetName)
            {
                case "ByName":
                    IEnumerable<AzureSubscription> subscriptions = new AzureSubscription[0];
                    if (Profile.Context != null && Profile.Context.Environment != null)
                    {
                        subscriptions = ProfileClient.RefreshSubscriptions(Profile.Context.Environment)
                            .Where(
                                s =>
                                    SubscriptionName == null ||
                                    s.Name.Equals(SubscriptionName, StringComparison.InvariantCultureIgnoreCase));
                    }

                    WriteSubscriptions(subscriptions);
                    break;
                case "ById":
                    WriteSubscriptions(ProfileClient.GetSubscription(new Guid(SubscriptionId)));
                    break;
                case "Default":
                    GetDefault();
                    break;
                case "Current":
                    GetCurrent();
                    break;
            }
        }
开发者ID:docschmidt,项目名称:azure-powershell,代码行数:28,代码来源:GetAzureSubscription.cs


示例11: CreateAzureSMProfile

 public static AzureSMProfile CreateAzureSMProfile(string storageAccount)
 {
     var profile = new AzureSMProfile();
     var client = new ProfileClient(profile);
     var tenantId = Guid.NewGuid();
     var subscriptionId = Guid.NewGuid();
     var account = new AzureAccount
     {
         Id = "[email protected]",
         Type = AzureAccount.AccountType.User
     };
     account.SetProperty(AzureAccount.Property.Tenants, tenantId.ToString());
     account.SetProperty(AzureAccount.Property.Subscriptions, subscriptionId.ToString());
     var subscription = new AzureSubscription()
     {
         Id = subscriptionId,
         Name = "Test Subscription 1",
         Environment = EnvironmentName.AzureCloud,
         Account = account.Id,
     };
     subscription.SetProperty(AzureSubscription.Property.Tenants, tenantId.ToString());
     subscription.SetProperty(AzureSubscription.Property.StorageAccount, storageAccount);
     client.AddOrSetAccount(account);
     client.AddOrSetSubscription(subscription);
     client.SetSubscriptionAsDefault(subscriptionId, account.Id);
     return profile;
 }
开发者ID:docschmidt,项目名称:azure-powershell,代码行数:27,代码来源:CommonDataCmdletTests.cs


示例12: SwitchesSlots

        public void SwitchesSlots()
        {
            // Setup
            var mockClient = new Mock<IWebsitesClient>();
            string slot1 = WebsiteSlotName.Production.ToString();
            string slot2 = "staging";

            mockClient.Setup(c => c.GetWebsiteSlots("website1"))
                .Returns(new List<Site> { 
                    new Site { Name = "website1", WebSpace = "webspace1" },
                    new Site { Name = "website1(staging)", WebSpace = "webspace1" }
                });
            mockClient.Setup(f => f.GetSlotName("website1")).Returns(slot1);
            mockClient.Setup(f => f.GetSlotName("website1(staging)")).Returns(slot2);
            mockClient.Setup(f => f.SwitchSlots("webspace1", "website1(staging)", slot1, slot2)).Verifiable();
            mockClient.Setup(f => f.GetWebsiteNameFromFullName("website1")).Returns("website1");

            // Test
            SwitchAzureWebsiteSlotCommand switchAzureWebsiteCommand = new SwitchAzureWebsiteSlotCommand
            {
                CommandRuntime = new MockCommandRuntime(),
                WebsitesClient = mockClient.Object,
                Name = "website1",
                Force = true
            };
            currentProfile = new AzureSMProfile();
            var subscription = new AzureSubscription { Id = new Guid(base.subscriptionId) };
            subscription.Properties[AzureSubscription.Property.Default] = "True";
            currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription;

            // Switch existing website
            switchAzureWebsiteCommand.ExecuteCmdlet();
            mockClient.Verify(c => c.SwitchSlots("webspace1", "website1", slot1, slot2), Times.Once());
        }
开发者ID:docschmidt,项目名称:azure-powershell,代码行数:34,代码来源:SwitchAzureWebSiteSlotTests.cs


示例13: AutomationClient

        public AutomationClient(AzureSubscription subscription,
            AutomationManagement.IAutomationManagementClient automationManagementClient)
        {
            Requires.Argument("automationManagementClient", automationManagementClient).NotNull();

            this.Subscription = subscription;
            this.automationManagementClient = automationManagementClient;
        }
开发者ID:pelagos,项目名称:azure-powershell,代码行数:8,代码来源:AutomationClient.cs


示例14: AzureSqlDatabaseReplicationAdapter

 /// <summary>
 /// Constructs a database adapter
 /// </summary>
 /// <param name="profile">The current azure profile</param>
 /// <param name="subscription">The current azure subscription</param>
 public AzureSqlDatabaseReplicationAdapter(AzureProfile Profile, AzureSubscription subscription)
 {
     this.Profile = Profile;
     this._subscription = subscription;
     ReplicationCommunicator = new AzureSqlDatabaseReplicationCommunicator(Profile, subscription);
     DatabaseCommunicator = new AzureSqlDatabaseCommunicator(Profile, subscription);
     ServerCommunicator = new AzureSqlServerCommunicator(Profile, subscription);
 }
开发者ID:BasheerAh,项目名称:azure-powershell,代码行数:13,代码来源:AzureSqlDatabaseReplicationAdapter.cs


示例15: ValidateSubscription

 /// <summary>
 /// Validates that the given subscription is valid.
 /// </summary>
 /// <param name="subscription">The <see cref="AzureSubscription"/> to validate.</param>
 public static void ValidateSubscription(AzureSubscription subscription)
 {
     if (subscription == null)
     {
         throw new ArgumentException(
             Common.Properties.Resources.InvalidDefaultSubscription);
     }
 }
开发者ID:docschmidt,项目名称:azure-powershell,代码行数:12,代码来源:SqlDatabaseCmdletBase.cs


示例16: SqlAuditAdapter

 public SqlAuditAdapter(AzureProfile profile, AzureSubscription subscription)
 {
     Profile = profile;
     Subscription = subscription;
     Communicator = new AuditingEndpointsCommunicator(Profile, subscription);
     AzureCommunicator = new AzureEndpointsCommunicator(Profile, subscription);
     IgnoreStorage = false;
 }
开发者ID:oaastest,项目名称:azure-powershell,代码行数:8,代码来源:SqlAuditAdapter.cs


示例17: DataMaskingEndpointsCommunicator

 public DataMaskingEndpointsCommunicator(AzureProfile profile, AzureSubscription subscription)
 {
     Profile = profile;
     if (subscription != Subscription)
     {
         Subscription = subscription;
         SqlClient = null;
     }
 }
开发者ID:shuainie,项目名称:azure-powershell,代码行数:9,代码来源:DataMaskingEndpointsCommunicator.cs


示例18: AzureSqlDatabaseTransparentDataEncryptionCommunicator

 /// <summary>
 /// Creates a communicator for Azure Sql Databases TransparentDataEncryption
 /// </summary>
 /// <param name="profile"></param>
 /// <param name="subscription"></param>
 public AzureSqlDatabaseTransparentDataEncryptionCommunicator(AzureProfile profile, AzureSubscription subscription)
 {
     Profile = profile;
     if (subscription != Subscription)
     {
         Subscription = subscription;
         SqlClient = null;
     }
 }
开发者ID:shuainie,项目名称:azure-powershell,代码行数:14,代码来源:AzureSqlDatabaseTransparentDataEncryptionCommunicator.cs


示例19: AzureSqlServerActiveDirectoryAdministratorCommunicator

 /// <summary>
 /// Creates a communicator for Azure SQL Server Active Directory administrator
 /// </summary>
 /// <param name="profile"></param>
 /// <param name="subscription"></param>
 public AzureSqlServerActiveDirectoryAdministratorCommunicator(AzureProfile profile, AzureSubscription subscription)
 {
     Profile = profile;
     if (subscription != Subscription)
     {
         Subscription = subscription;
         SqlClient = null;
     }
 }
开发者ID:BasheerAh,项目名称:azure-powershell,代码行数:14,代码来源:AzureSqlServerActiveDirectoryAdministratorCommunicator.cs


示例20: SecureConnectionEndpointsCommunicator

 public SecureConnectionEndpointsCommunicator(AzureProfile profile , AzureSubscription subscription)
 {
     Profile = profile;
     if (subscription != Subscription)
     {
         Subscription = subscription;
         SqlClient = null;
     }
 }
开发者ID:naveedaz,项目名称:azure-powershell,代码行数:9,代码来源:SecureConnectionEndpointsCommunicator.cs



注:本文中的Microsoft.Azure.Common.Authentication.Models.AzureSubscription类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Models.MemoryDataStore类代码示例发布时间:2022-05-26
下一篇:
C# Models.AzureSMProfile类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap