Esempio n. 1
0
        public async Task <ARMClient> GetArmClient()
        {
            if (armClient == null)
            {
                var auth  = Container.ContainerService.Current.Resolve <IAuthViewModel>();
                var token = await auth.GetTokenAsync(Constants.RM_TOKEN_AUDIENCE_v1);

                armClient = new ARMClient(token);
            }
            return(armClient);
        }
Esempio n. 2
0
        private static async Task Run()
        {
            var armClient = ARMClient.GetDynamicClient(apiVersion: "2014-04-01", authHelper: new AuthHelper(AzureEnvironments.Prod));

            var resrouceGroups = await armClient.Subscriptions["{subscriptionId}"]
                                 .ResourceGroups
                                 .GetAsync <JObject>();

            foreach (var resrouceGroup in resrouceGroups.value)
            {
                var sites = (Site[])await armClient.Subscriptions["{subscriptionId}"]
                            .ResourceGroups[resrouceGroup.name]
                            .Providers["Microsoft.Web"]
                            .Sites
                            .GetAsync <Site[]>();

                if (sites.Length == 0)
                {
                    Console.WriteLine("ResrouceGroup: {0} Doesn't contain any websites!", resrouceGroup.name);
                }
            }
        }
Esempio n. 3
0
 public void InitArmClient(string accessToken)
 {
     armClient = new ARMClient(accessToken);
 }