I am trying to schedule a powershell script to run which will export some Graph API data into some CSV files. I have a script that works, however, it requires you to copy and paste a device code every time you run a script.
The script need to run with delegated permissions as the call does not support application permissions.
Thanks
Ben
You can get started from here.For your scenario you can use ROPC flow to Authenticate. And also remember that the ROPC flow is not recommended by Microsoft.
Related
I'm busy implementing a Jenkins build server for Delphi 2007 projects, with DUnit for test applications. The previous solution was built in a very old version of Hudson, with extensive test code and a large scale of production applications. The build scripts are therefore established and I've managed to get the builds going.
However, I'm having some problems with the test applications. These normally work fine from a cmd line execution, which calls TestApp.exe UseTestRunner:Text. However, when running GUI tests, the windows do not popup and the test results are inconsistent.
I suspect it has something to do with the Jenkins service account permissions, but I'm not sure how to proceed. The service currently uses the logged in user account, for various permissions and access to the Delphi environment options that's required for builds. Thus the option to use the Local System account with access to the desktop is tricky and I'm not sure if that will fix the problem.
I'm new to the Jenkins environment and would appreciate any help!
I have a .NET Core 3.0 self-contained CLI app and I would like to make it available in Azure DevOps Release Pipelines Task. I wish to have task like "Use MyApp". Something like "Use Node" or "Use .NET Core" style. The task flow would be like these:
Task1: Use MyApp
Download EXE file from github
Set PATH to include the location of EXE
Task2: Run MyApp
Run MyApp with args from Az DevOps GUI
I have been going through many articles but I have yet to see any EXE file example. This is the closest I can get but it was NPM package. Do I need to package my CLI app into NPM, if thats even possible? https://devkimchi.com/2019/07/03/building-azure-devops-extension-on-azure-devops-2/
Thanks for advise. //Ardi
After mashing-up various samples, I finaly made this to work. I still have chose Node+Typescript instead of Powershell.
Here's a code how I wrapped a self-contained app EXE file and made available as Azure Pipelines Task.
https://github.com/rdagumampan/yuniql-azure-pipelines-tasks
I'm testing my assumptions at the moment. I have my Asp.Net MVC application located at www.myapp.com/app and a third-party CMS system on www.myapp.com/.
The web-site is set up like described in this answer
At the moment I can publish both of the applications separately and manually from Visual Studio and it works fine.
However, I'm trying to publish my application from a build server where I'm using Azure Power-Shell scriplets:
PS> Publish-AzureWebsiteProject -Name myApp -Package MyWebDeployPackage.zip
However, documentation does not mention if you can publish with this scriplet to a non-root folder.
Any way I can publish an application to ~/app from a command line?
UPD: I can publish from msbuild via
msbuild .\SolutionName.sln /p:DeployOnBuild=true /p:PublishProfile=ProfileName /p:Password=passwordForAzurePublishing /p:AllowUntrustedCertificate=true
Where ProfileName is a web-deploy profile configured to deploy to sub-folder of Azure Web-Site and Password is deployment password from Azure profile.
However this is not an optimal solution: to deploy to test and to production environment, I need to build the application twice, which I'd like to avoid: if I compile views, it takes 7-10 minutes (we have 800 views). Doing this twice is a waste of time.
UPD 2: Created an issue on Azure SDK Tools repository: https://github.com/Azure/azure-sdk-tools/issues/2667
I don't think this is possible from PowerShell, but I might be mistaken. Looking at their publish code here https://github.com/Azure/azure-sdk-tools/blob/master/src/ServiceManagement/Services/Commands.Utilities/Websites/WebsitesClient.cs#L1136-L1168
and also here https://github.com/Azure/azure-sdk-tools/blob/master/src/ServiceManagement/Services/Commands.Utilities/Websites/WebsitesClient.cs#L1218-L1229
they don't have a parameter for the app name, and the code in the second link builds the site name/slot manually.
I would say open an issue here https://github.com/Azure/azure-sdk-tools/issues for this and somebody from the Azure PowerShell team should look at it.
The project I am on is using TFS Build in conjunction with Web Deploy to handle the deployments of the web site and service to the servers. We also have a windows service that needs to be deployed to the server as well.
My question is: Is there a way to deploy the Windows Service to the Web Server from the TFS Build server?
The other issue I have is that the service needs to be stopped before it can be deployed. I have tried to modify the Build Configuration file, but could not manage to get it to work.
Thanks.
Options:
If you install TFSBuildagent service on the web server and grant the user which runs the service Admin rights on the web server, then you can create a new build definition just for the deployment/installation. This is fairly simple and straight forward, but this would only work when you have limited number of web servers (who wants to install TFS BUild agent on all 2000 servers) and only work in the non-prod environment. This is how we are doing it for non-prod deployments, I have created a build definition which is just for deployment, which takes care of all the things like stopping services etc.
If the user which runs the TFSBuild Service on the build server have enough rights on the web server then you can use psexec or powershell to run your commands remotely. Read the below links: 1. PSEXEC
Powershell Remote commands
What did you do to stop the service in your build configuration file? Does the user have enough rights?
There is no inbuilt activity/process which can help you run scripts on remote machines in TFS build workflow.
Step 1 for you is to identify how you are going to run scripts on the remote machine, as mentioned above you can either use PSEXEC or Powershell (though running PowerShell on remote computers may be a little more complicated to set up).
Step2, write the actual scripts to do the work, stop services, install MSI etc.
Step3, Edit your current build defintion - create a new custom activity or make use of InvokeProcess activity from within your build definition to invoke the script that you have created in Step 2. InvokeProcess Activity
Running TFS 2010
I am trying to do a proof of concept, having batch files run as part of the build process. I have an 'invokeProcess' in my build seqeunce which runs a batch file. When I run the build, it 'partially succeeds' and then shows an 'access denied' error on the batch file.
Thoughts? Honestly I'm not even sure how to diagnose what user it is trying to run under.
Is your build server different than your TFS server? In our environment, our build server runs all the windows services that execute the builds. Those builds are executed under the context of the user id that the build service is configured to start with.
To execute a batch file, you not only need to give permissions to the batch file itself, but you also need to grant rights to the cmd.exe file (since this will execute a new command line process) as well as any executables your batch file may call.
Try running procmon (http://technet.microsoft.com/en-us/sysinternals/bb896645) and execute your build again - it will show you exactly what files the system is denying access to.
Have you verified that the service account that is the identity for the build service has access to the batch location? You can find the service account in the TFS Administration Console (available on your TFS Server)