Ejemplo n.º 1
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}");
        }