static async Task Main(string tenantId, string username, bool deleteApps)
        {
            AppsManagement             appsManagement             = new AppsManagement();
            DeveloperCredentialsReader developerCredentialsReader = new DeveloperCredentialsReader();
            TokenCredential            tokenCredential            = developerCredentialsReader.GetDeveloperCredentials(username, tenantId);

            string tenant = await appsManagement.GetTenantName(tokenCredential);

            Console.WriteLine($"My apps in {tenant}");
            IEnumerable <AppInfo> myApps = (await appsManagement.ListMyApplications(tokenCredential));

            DisplayAppInfo(myApps);

            // Delete all my apps in tenant
            if (deleteApps)
            {
                await appsManagement.DeleteApplications(myApps, tokenCredential);
            }

            Console.WriteLine();
            Console.WriteLine($"My deleted apps  {tenant}");
            var deletedApps = (await appsManagement.ListDeletedApplications(tokenCredential))
                              .OrderBy(a => a.deletedDateTime);

            DisplayAppInfo(deletedApps);

            await appsManagement.PurgeApplications(deletedApps, tokenCredential);
        }
Пример #2
0
        private TokenCredential GetTokenCredential(ProvisioningToolOptions provisioningToolOptions, string?currentApplicationTenantId)
        {
            DeveloperCredentialsReader developerCredentialsReader = new DeveloperCredentialsReader();

            return(developerCredentialsReader.GetDeveloperCredentials(
                       provisioningToolOptions.Username,
                       currentApplicationTenantId ?? provisioningToolOptions.TenantId));
        }