Exemplo n.º 1
0
 public void SetCurrentContext(AsAzureAccount azureAccount, AsAzureEnvironment asEnvironment)
 {
     _profile.Context = new AsAzureContext(azureAccount, asEnvironment)
     {
         TokenCache = AsAzureClientSession.TokenCache.Serialize()
     };
 }
Exemplo n.º 2
0
        public AsAzureEnvironment CreateEnvironment(string environmentName)
        {
            var env = new AsAzureEnvironment(environmentName);

            env.Endpoints.Add(AsAzureEnvironment.AsRolloutEndpoints.AdAuthorityBaseUrl, AsAzureClientSession.GetAuthorityUrlForEnvironment(env));
            env.Endpoints.Add(AsAzureEnvironment.AsRolloutEndpoints.RestartEndpointFormat, AsAzureClientSession.RestartEndpointPathFormat);

            return(env);
        }
Exemplo n.º 3
0
        public static string GetAuthorityUrlForEnvironment(AsAzureEnvironment environment)
        {
            var             environmentKey = AsAzureRolloutEnvironmentMapping.Keys.FirstOrDefault(s => environment.Name.Contains(s));
            AsAzureAuthInfo authInfo       = null;

            if (string.IsNullOrEmpty(environmentKey) || !AsAzureRolloutEnvironmentMapping.TryGetValue(environmentKey, out authInfo))
            {
                throw new ArgumentException(Properties.Resources.UnknownEnvironment);
            }

            return(authInfo.AuthorityUrl);
        }
        protected override void BeginProcessing()
        {
            base.BeginProcessing();
            if (string.IsNullOrEmpty(RolloutEnvironment))
            {
                RolloutEnvironment = AsAzureClientSession.GetDefaultEnvironmentName();
            }

            if (AsAzureClientSession.Instance.Profile.Environments.ContainsKey(RolloutEnvironment))
            {
                AsEnvironment = (AsAzureEnvironment)AsAzureClientSession.Instance.Profile.Environments[RolloutEnvironment];
            }
            else
            {
                AsEnvironment = AsAzureClientSession.Instance.Profile.CreateEnvironment(RolloutEnvironment);
            }
        }
 /// <summary>
 /// Creates new instance of AsAzureContext.
 /// </summary>
 /// <param name="account">The AS azure account object</param>
 /// <param name="environment">The AS azure environment object</param>
 public AsAzureContext(AsAzureAccount account, AsAzureEnvironment environment)
 {
     Account     = account;
     Environment = environment;
 }