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.");
        }
Ejemplo n.º 2
0
        public async Task DeployRemotely(FileInfo csdl, string appId, string tenantId, string subscriptionId, bool seedData)
        {
            var config = configManager.GetRootConfig();

            if (appId == null)
            {
                throw new Exception("Please specify unique app name for remote deployment");
            }

            if (csdl == null)
            {
                throw new Exception("Please specify the schema file for your project");
            }

            tenantId ??= config.Tenant;
            subscriptionId ??= config.Subscription;

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

            app.Out.WriteLine($"Schema Path: {csdl.FullName}");
            app.Out.WriteLine($"App name: {appId}");
            app.Out.WriteLine($"Tenant Id: {tenantId}");
            app.Out.WriteLine($"Subscription Id: {subscriptionId}");

            var args = new ProjectRunArgs()
            {
                SeedData = seedData
            };

            var image = await imageProvider.GetCredentials();

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

            var deployment = await remoteManager.Create(appId, csdl.FullName, args);

            var project = deployment.Project;

            configManager.SaveProjectData(project);
            app.Out.WriteLine($"App created successfully. Your app URL is: {project.AppUrl}");
        }
Ejemplo n.º 3
0
        public async Task UpdateRemoteService(string csdlPath, string appId, string tenantId, string subscriptionId)
        {
            var config = configManager.GetRootConfig();

            if (appId == null)
            {
                throw new Exception("Please specify the app to update");
            }

            var project = configManager.LoadProject(appId);

            csdlPath ??= project.LocalSchemaPath;
            if (csdlPath == null)
            {
                throw new Exception("Please specify the schema file for your project");
            }

            var csdl = new FileInfo(csdlPath);

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

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

            app.Out.WriteLine($"Schema path: {csdl.FullName}");
            app.Out.WriteLine("Updating app, please wait...");

            var image = await imageProvider.GetCredentials();

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

            await remoteManager.UpdateSchema(project, csdl.FullName);

            configManager.SaveProjectData(project);
            app.Out.WriteLine($"Update complete. App url is {project.AppUrl}");
        }