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); }
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); } } }
public void InitArmClient(string accessToken) { armClient = new ARMClient(accessToken); }