An Azure VM provisioned and proxy settings are configured. When we do the remote login into the VM machine and insert powershell command as follows:
Find-Module dockeraccesshelper
We get the reponse:
Version Name Repository Description
------- ---- ---------- -----------
0.0.3 dockeraccesshelper PSGallery Allow a user account to access the docker engine...
So it is obvious that from Administrative Powershell command line in the VM machine , I can query for a module in the powershell repository. To confirm it further I issued the following command:
Get-ItemProperty -Path "Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
And I could see the proxy server listed. I could also see the proxy server listed under Environment Variable listings.
But If I try to execute a powershell script file on the VM from the Azure Devops Pipeline I get the following error:
WARNING: MSG:UnableToDownload «https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409» «»
WARNING: Unable to download the list of available providers. Check your internet connection.
##[error]PackageManagement\Get-Package : No match was found for the specified search criteria and module names 'VSSetup'.
It is understood that VM admin has more access rights than the Azure DevOps Build Agent. But it should at least be able to access the internet.
Let me elaborate more about what the powershell script is doing :
Install some powershell Modules from the ps gallery.
If I run the following as inline command, I get the following response from the pipeline:
Log on to the computer with an account that has Administrator rights, and then try again, or install
'C:\windows\ServiceProfiles\NetworkService\Documents\WindowsPowerShell\Modules'
by adding "-Scope CurrentUser" to your command.
You can also try running the Windows PowerShell session with elevated rights (Run as Administrator).
So it is also abvious that the build agent has to have an elevated access rights as admin to install/update modules. Any hint on how to do it ?
Related
I'm using GitHub Enterprise with a self-hosted runner that runs on my dev server to accept the build and deploy commands to that server. The build steps are running successfully, but I'm struggling with the deploy steps. The application that is being deployed is an IIS application and I'm trying to run a powershell script I've written to perform the IIS update (stops the IIS server, copies build package contents over to inetpub, starts the IIS server). When the runner executes this script, it fails because it doesn't have permissions to replace the inetpub contents, among other permissions issues. Until now with GitHub Enterprise, I would just run this step as administrator, but I can't find a way to elevate the runner's privileges to do so. Is there syntax for this? This is what I'm currently trying:
- name: Deploy
shell: cmd
run: |
cd myBuildLocation
powershell -file deployrelease.ps1 -inetpubPath C:\inetpub\mySiteName
I have some jenkins powershell IIS scripts. I need to run them as admin in jenkins pipeline to make it work. When I try it from jenkins it gives me "Error: Cannot read configuration file due to insufficient permissions". But when I run it from my local ps as admin, it works perfectly. How can I resolve this issue? Thanks!
I have a host machine with Hyper-V enabled, and I have a Hyper-V guest running on this machine. Becauze I can't drag&drop files to the VM, I wrote a script to do this for me, which is integrated in TotalCommander, and which uses Copy-VMFile.
My problem is that the PS script works only if I run it as admin, otherwise I get the error "You do not have the required permission to complete this task."
Why do I need admin to copy from the host machine to the guest OS? And is there a way, some policy which would allow me to circumvent this? It is annoying to enter a password every time I want to copy some files.
I have some Powershell scripts for deploying our applications to test machine. These have to be executed using Invoke-Command from the developer machine. Is there anyway to log host machine name/IP from which these scripts are called.
For example:
If developer foo deployed an application using the script from devmachine1 i want to get the name/IP of the devmachine1 and log it in our test machine.
We are using Powershell V4.0. Can upgrade to 5.0 if required.
answering this to mark the question as solved. just incase if some one is looking for an answer.
I am passing computer name $env:COMPUTERNAME as a parameter to the remote script.
Getting the remote username using $PSSenderInfo.ConnectedUser in the remote script.
I am facing a very strange issue trying to run a Remote PowerShell script from the new build system of Visual Studio Online.
Context:
I have a Build server that I host on my own VM. I have also created a second VM where I want the PowerShell script to be run on.
When I run a build from the Build server, I want to create a task that run a PowerShell script on a remote machine. Sounds easy.
Both machines have everything configured to run the Remote PowerShell. (I think)
Problem:
If I manually run the script from the build server, the script is properly executed on my remote machine.
But, if I run the script by starting a new build, it doesn't work, I always get an error message
New-PSSession : [xxx.cloudapp.net] Connecting to remote server xxx.cloudapp.net failed with the following error message : Access is denied. For more information, see the about_Remote_Troubleshooting Help topic.
Have you faced this issue before with VSOnline?
This can happen if there isn't a trust relationship between the remote machine and the build machine. E.g. you could look at the hosts.equiv file on the remote machine and make sure it trusts the build machine.
If that doesn't help then more info might be needed, like how you're trying to sign in, what build agent account you're running as.
Guy