예제 #1
0
        private static async Task IntuneHelperCall(IConfigurationRoot config)
        {
            const string userPrincipalName = "<user>";

            var graphClient  = GetAuthenticatedGraphClient(config);
            var intuneHelper = new IntuneHelper(graphClient);

            await ListManagedDevices(intuneHelper, userPrincipalName);

            WebApp app = await PublishWebApp(
                intuneHelper,
                "http://aka.ms/30DaysMsGraph",
                "30 Days of MS Graph",
                "Microsoft Corporation");

            await AssignAppToAllUsers(intuneHelper, app);

            DeviceConfiguration deviceConfiguration = await CreateWindowsDeviceConfiguration(
                intuneHelper,
                "Windows 10 Developer Configuration",
                "http://aka.ms/30DaysMsGraph",
                true);

            await AssignDeviceConfigurationToAllDevices(intuneHelper, deviceConfiguration);
        }
예제 #2
0
        private static async Task <WebApp> PublishWebApp(IntuneHelper intuneHelper, string url, string name, string publisher)
        {
            var webApp = await intuneHelper.PublishWebApp(url, name, publisher);

            Console.WriteLine($"Published web app: {webApp.Id}: {webApp.DisplayName} - {webApp.AppUrl}");

            return(webApp);
        }
예제 #3
0
        private static async Task ListManagedDevices(IntuneHelper intuneHelper, string userPrincipalName)
        {
            var managedDevices = await intuneHelper.ListManagedDevicesForUser(userPrincipalName);

            Console.WriteLine($"Number of Intune managed devices for user {userPrincipalName}: {managedDevices.Count()}");
            if (managedDevices.Count() > 0)
            {
                Console.WriteLine(managedDevices.Select(x => $"-- {x.DeviceName} : {x.Manufacturer} {x.Model}").Aggregate((x, y) => $"{x}\n{y}"));
            }
        }
예제 #4
0
        private static async Task AssignDeviceConfigurationToAllDevices(IntuneHelper intuneHelper, DeviceConfiguration deviceConfiguration)
        {
            var assignments = await intuneHelper.AssignDeviceConfigurationToAllDevices(deviceConfiguration);

            Console.WriteLine($"Device Configuration {deviceConfiguration.DisplayName} has {assignments.Count()} assignments");
        }
예제 #5
0
        private static async Task AssignAppToAllUsers(IntuneHelper intuneHelper, MobileApp app)
        {
            var assignments = await intuneHelper.AssignAppToAllUsers(app);

            Console.WriteLine($"App {app.DisplayName} has {assignments.Count()} assignments");
        }
예제 #6
0
        private static async Task <DeviceConfiguration> CreateWindowsDeviceConfiguration(IntuneHelper intuneHelper, string displayName, string edgeHomePage, bool enableDeveloperMode)
        {
            var deviceConfiguration = await intuneHelper.CreateWindowsDeviceConfiguration(
                displayName,
                edgeHomePage,
                enableDeveloperMode);

            Console.WriteLine($"Created Device Configuration: {deviceConfiguration.Id}: {deviceConfiguration.DisplayName}");

            return(deviceConfiguration);
        }