Ejemplo n.º 1
0
        public async Task DeleteRemoteService(string appName, string tenantId, string subscriptionId)
        {
            if (appName == null)
            {
                throw new Exception("Please specify the app to delete");
            }

            var config = configManager.GetRootConfig();

            var project = configManager.LoadProject(appName);

            tenantId ??= project.TenantId ?? config.Tenant;
            subscriptionId ??= project.SubScriptionId ?? config.Subscription;

            if (string.IsNullOrEmpty(tenantId))
            {
                throw new Exception("Please provide value for tenant");
            }


            var image = await imageProvider.GetCredentials();

            var remoteManager = new RemoteServiceManager(tenantId, subscriptionId, image)
            {
                OnAuthenticating = () => app.Out.WriteLine("Signing into your Azure subscription...")
            };

            app.Out.WriteLine($"Deleting {appName} and related resources...");
            await remoteManager.Delete(project);

            configManager.DeleteProjectData(appName);
            app.Out.WriteLine($"The app {appName} and its related resources have been delete.");
        }