Specific files not getting copied to artifactstagingdirectory - azure-pipelines-release-pipeline

I am following the below article to Deploy ASP.NET apps to Azure virtual machines.
https://www.visualstudio.com/en-us/docs/release/examples/azure/net-to-azure-vm#build
I am getting below error:
##[error]System.Management.Automation.RuntimeException: The term 'C:\temp\ConfigureWebserver.ps1' is not recognized as the name of a
cmdlet, function, script file, or operable program. Check the spelling
of the name, or if a path was included, verify that the path is
correct and try again.
---> System.Management.Automation.RuntimeException: The term 'C:\temp\ConfigureWebserver.ps1' is not recognized as the name of a
cmdlet, function, script file, or operable program. Check the spelling
of the name, or if a path was included, verify that the path is
correct and try again.
If I manually copy the ConfigureWebserver.ps1 file in the VM and then deploy the build,then it is able to successfully deploy.

Use the Windows Machine File Copy or the Azure File Copy task to copy the script to the VM prior to attempting to run it.

Related

File System Move File doesn not work but Script Task System.IO does

I have an SSIS Package that as part of the process uses a File System Task to move a file to an archive folder.
The Source is a variable from a For Each Loop. The Destination is a File Connection with the connection string set to a Variable. The variable is static assigned in dev, and pulled from a package config when deployed.
Everything works in VS in the dev environment. I deploy to SQL Server and schedule with a SQL Job. Job fails. Immediately, I think it's a permissions issue but my Proxy has Modify to the destination and read on the source.
I then rewrite the package so the move file is done in a script task using system.io. Deploy that and it works with the same proxy account on the job, so it's not a permissions issue.
I'm happy it works, but want to know why it failed before.
The error I got when it failed was, "File or Directory "\destinationpath" represented by connection "archiveconnectioname" does not exist."
Has anyone any ideas?

google cloud functions: downloading a file to the root directory python 3.9

I have a file I need to get into the Google Cloud Function's directory for a multi-step problem. Matplotlib: Custom fonts in cloud functions using Python 3.9
I'm not sure how to do it. Do I do it as a function in cloud functions? or use the console terminal for the project? I tried that and looked in the root directory and there was nothing there. I can only change projects and not change to a specific function directory.
Can someone please show me how to put this file https://www.1001freefonts.com/balthazar.font into the function's file system so it can be called during execution?
When you deploy a Cloud Function to GCP, you can supply a ZIP file or a directory that contains your source code and additional artifacts/files that you may need.
To perform the deployment of the ZIP or directory, you will want to use the gcloud command. A good article on this is Deploying from Your Local Machine.
The detailed documentation on the CLI can be found at gcloud functions deploy.
In your example, you could create a directory that contains your source and your font file and both will be present in the context of the Cloud Function. I believe that if you want to reference the files, you will want to use the local current directory in your code. For example, instead of coding /myfontfile.font you might code ./myfontfile.font.
Here are some references to this technique:
Cloud Functions: how to upload additional file for use in code?

Why PowerShell profile not load function after creating exe

I created a function within PowerShell profile and it was running successfully but whenever I converted my file from extension .ps1 to .exe and run .exe file, it will be show the error "The term 'Check-Expiry' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling
of the name, or if a path was included, verify that the path is correct and try again."

Why can't I run my Perl job in Hudson?

I tried to do this in Hudson but:
I have a script in Perl on my server (windows): lets say: d\util\demo.pl I want to have it running in Hudson. so I go to Hudson, create new job, go to: Build Execute Windows batch command and add: perl.exe d\util\demo.pl
I got this error: 'perl.exe' is not recognized as an internal or external command, operable program or batch file.
please help!
It can't find the perl.exe in the path of the agent that is running the task. Verify that perl is properly installed AND that the path where perl.exe was in stalled to is in you system path on EVERY agent that will run this task.
Can you run that command from any folder of the server?
If yes, than the Hudson server runs definitely under a different user account. Make sure that the user account Hudson is running under has all necessary environment variables set.
If not, than add the full qualified path to the perl.exe (e.g. C:\program files\perl\bin\perl.exe d:\util\demo.pl). If this doesn't help, you have to also set all environment variables (see "if yes").

SSIS package not running when called as step in SQL Job

I have a .dtsx file (an SSIS package) that downloads files from an FTP server and imports data. It runs fine whenever I run it manually. However, when I schedule calling the package as a step in a SQL server agent job, it fails. The step it fails at is the one where I call a .bat file. The error in the job history viewer says this:
Error: 2009-05-26 12:52:25.64
Code: 0xC0029151 Source: Execute
batch file Execute Process Task
Description: In Executing
"D:\xxx\import.bat" "" at "", The
process exit code was "1" while the
expected was "0". End Error DTExec:
The package execution returned
DTSER_FAILURE (1).
I think it's a permissions issue, but I'm not sure how to resolve this. The job owner is an admin user, so I've verified they have permissions to the directory where the .bat file is located. I've tried going into Services and changing the "Log On As" option for SQL Server Agent, and neither option works (Local System Account and This Account). Does anyone have ideas as to what other permissions need to be adjusted in order to get this to work?
I tried executing just the batch file as a SQL Job step, and it gave more specifics. It showed that it failed when I was trying to call an executable, which was in the same directory as my .bat file, but not in the windows/system32 directory, which is where it was executing from.
I moved the executable to the system32 directory, but then I had no clue where my files were being downloaded to. Then I found that there's a property for the Execute Process Task (the one that executes the .bat) called WorkingDirectory. I set this to be the directory where the bat is located, moved the executable back into the same one as the .bat file, and it's now working as expected.
For me it was a permissions issue. Go to Environment --> Directories, then change Local directory to something the SQLAgentUser can access. I used C:\temp. Click the dropdown for Save, and choose "Set defaults".
Are you executing the SSIS job in the batch file, or is the batch file a step in the SSIS control flow?
I'm assuming the latter for this answer. What task are you using to execute the batch file (e.g. simple execute program task or a script task). If the latter, it looks like your batch file is actually failing on some step, not the SSIS script. I'd check the permissions of what your batch file is trying to access
In fact, it might be a better idea to rewrite the batch file as a script task in SSIS, because you'll get much better error reporting (it'll tell you which step in the script fails).
You could try executing the batch file using the runas command in a command window. If you try and execute it under the local system or network system account, it should give you a better error. If it does error, you can check the error level by going "echo %ERRORLEVEL%".
If it wasn't the latter, and you're executing the SSIS package via a batch file, why?
Are you possibly accessing a mapped drive in your .bat file? If so, you can't rely on the mapped drive from within the service, so you'd have to use UNC path.
I had the same error and I resolved it by logging on to the user account that runs the job, opened Coreftp site in question there, test the site access, made the change there (in my case, I had to reenter the new password) and now it works.
So yes, it is an issue of file access. This one is file access to the coreftp site in question.