Am working on ARM Templates Deployment using powershell Command line
$manifestDetails = Get-Content ./manifest.json | ConvertFrom-Json
which is going to be find and run the .json file .It is running fine in my local PC. But when am running the same line through VSTS PowerShell task, then am receiving following issue:
At C:\XX_work\r7\a\CIBuild\drop\XX\XX\Deployment\Manif
estAzureDeployment.ps1:191 char:21
+ $manifestDetails = Get-Content ./manifest.json | ConvertFrom-Json
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\XX...a\manifest.json:String) [Get-Content], ItemNotFoundEx
ception
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand
So, please give me suitable suggestions for this issue
Using absolute path through built-in release variable instead.
For example, System.DefaultWorkingDirectory ($(System.DefaultWorkingDirectory)): The directory to which artifacts are downloaded during deployment of a release. The directory is cleared before every deployment if it requires artifacts to be downloaded to the agent. Same as Agent.ReleaseDirectory and System.ArtifactsDirectory.
Related
I'm trying to run a Powershell script as a part of my build pipeline on Azure DevOps, but I keep getting the following error:
Unable to find type [System.Web.MimeMapping].
At D:\a\1\s\upload.ps1:31 char:15
+ $sourceMime = [System.Web.MimeMapping]::GetMimeMapping($sourceItem.Fu …
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Web.MimeMapping:TypeName) [], ParentContainsErrorRecordException
FullyQualifiedErrorId : TypeNotFound
The related bit of code in my Powershell script that's throwing the error:
# Get the source file contents and details, encode in base64
$sourceItem = Get-Item $sourceFile
$sourceBase64 = [Convert]::ToBase64String([IO.File]::ReadAllBytes($sourceItem.FullName))
$sourceMime = [System.Web.MimeMapping]::GetMimeMapping($sourceItem.FullName)
Any Pipelines gurus out there that can help?
Note: I've already tried using Add-Type -AssemblyName System.Web to no avail. This seems to be something related to the hosted agent (windows-latest) since the script runs fine on my local machine.
Thanks in advance.
I've upgraded to dotnet sdk version 3.1 and am trying to publish my powershell module. I am using powershell 5.1.
I run the command:
Publish-Module -Path "C:\sources\myModules\InstallationUtils\" -NuGetApiKey "xxxxxxx" -Repository internal.packages.org"
and get the error:
[C:\Users\xxxxxx\AppData\Local\Temp\469d7c83-6e1a-4366-b948-6a415b0279be\Temp.csproj]
Successfully created package
'C:\Users\xxxxxx\AppData\Local\Temp\158464074\myModules\InstallationUtils\InstallationUtils.1.4.8.nupkg'.
C:\Program Files\dotnet\sdk\3.1.201\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error :
Index was outside the bounds of the array.
[C:\Users\xxxxxx\AppData\Local\Temp\469d7c83-6e1a-4366-b948-6a415b0279be\Temp.csproj]
'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.1\PSModule.psm1:10944 char:17
+ ... Publish-PSArtifactUtility #PublishPSArtifactUtility_Param ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : FailedToCreateCompressedModule,Publish-PSArtifactUtility
Is anyone have similar issues and managed to fix it?
thanks
I have a work around, which involves replacing the old version of version nuget.exe in
C:\Users\xxxxx\AppData\Local\Microsoft\Windows\PowerShell\PowerShellGet\
with the latest version of nuget.exe .
I found the work around on SQLDBAWithABeard but I am hoping that there is a better solution than this?
In my ongoing war with WSL2/VSCODE I'm trying to completely remove the .vscode-insiders directory from my machine.
rm -rf wont work, neither will delete from windows. Anyone know How I can destroy this thing?
I'm trying to get a dev environment set up with WSL2 VS CODE and Docker in Windows 10 insiders (18965).
I ran into problems trying to install the remote development pack, specifically the /ms-vscode-remote.remote-wsl-0.39.4 extension which is causing no end of problems.
However When I try to remove all vs code-insiders residue I get permissions problems with:
:/mnt/c/Users/micro/.vscode-insiders/extensions/ms-vscode-remote.remote-wsl-0.39.4/scripts/wslServer.sh
I cant delete it from the Ubuntu side with rm -rf
cannot remove 'wslServer.sh': No such file or directory
I cant delete it from windows explorer - no permissions
I cant delete it from powershell as admin running Remove-item.
Looked at all the existing answers on stack and none have a solution as far as i can see.
Would love some help?
Remove-Item : Access is denied
At line:1 char:1
+ Remove-Item wslServer.sh
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (C:\Users\micro...ts\wslServer.sh:String) [Remove-Item], Unauthorized
AccessException
+ FullyQualifiedErrorId : ItemExistsUnauthorizedAccessError,Microsoft.PowerShell.Commands.RemoveItemCommand
Remove-Item : Cannot find path
'C:\Users\micro.vscode-insiders\extensions\ms-vscode-remote.remote-wsl-0.39.4\scripts\wslServer.sh' because it does
not exist.
At line:1 char:1
+ Remove-Item wslServer.sh
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\Users\micro...ts\wslServer.sh:String) [Remove-Item], ItemNotFoundEx
ception
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand
Ctrl+alt+delete - right click 'Windows Subsystem For Linux' - end task.
Now try deleting the folder or let VScode do it for you.
Followed Export SQL database example using link :
https://learn.microsoft.com/en-us/azure/sql-database/sql-database-export-powershell#export-sql-database-example
Getting below error:
New-AzureRmSqlDatabaseExport : ResourceNotFound: The Resource 'Microsoft.Sql/servers/XXX.database.windows.net/databases/[DBNAME]' under resource group 'Default-SQL-SoutheastAsia' was
not found.
At [FilePath]\sample.ps1:24 char:18
+ $exportRequest = New-AzureRmSqlDatabaseExport –ResourceGroupName $ResourceGroupN ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureRmSqlDatabaseExport], CloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Sql.ImportExport.Cmdlet.NewAzureSqlDatabaseExport
Get-AzureRmSqlDatabaseImportExportStatus : Cannot bind argument to parameter 'OperationStatusLink' because it is null.
At [FilePath]\sample.ps1:30 char:63
+ Get-AzureRmSqlDatabaseImportExportStatus -OperationStatusLink $exportRequest.Ope ...
+ CategoryInfo : InvalidData: (:) [Get-AzureRmSqlDatabaseImportExportStatus], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.Azure.Commands.Sql.ImportExport.Cmdlet.GetAzureSqlDatabaseImportExportStatus
Any help?
I had this same issue today, actually. I think if you change your server name to not use the fully-qualified name, that might do it. So, just use "xxxxx."
At least that's what worked for me.
You need to verify that your Automation account has latest modules imported and are up to date (AzureRM.Automation – AzureRM.Profile – AzureRM.Sql) atleast to Version: 2.5.0. If modules show a different version, i.e. 1.0.3 then:
navigate to assets in the automation account, select modules and click on
Update Azure Modules
.
Wait for the modules to get updated it normally takes a few minutes
Can anyone please suggest me what is wrong - I am calling second script from first so that
I can run the compare in background or parallel, due to bug in IDM software I need to
execute loop two times.
I need to call 5 scripts from my main script ( frist script) so that all five scripts run
parallelly.
First Script -
==================================================
Error message
Attribute cannot be added because it would cause the variable sbtFile with value C to become invalid.
+ CategoryInfo : MetadataError: (:) [Start-Job], ValidationMetadataException
+ FullyQualifiedErrorId : ValidateSetFailure,Microsoft.PowerShell.Commands.StartJobCommand
The command cannot find the job because the CompareCtrlMasterCtrlModelESS name was not found. Verify the value of the Name parameter, and then try the comman
d again.
+ CategoryInfo : ObjectNotFound: (CompareCtrlMasterCtrlModelESS:String) [Wait-Job], PSArgumentException
+ FullyQualifiedErrorId : JobWithSpecifiedNameNotFound,Microsoft.PowerShell.Commands.WaitJobCommand
The command cannot find the job because the CompareCtrlMasterCtrlModelESS name was not found. Verify the value of the Name parameter, and then try the comman
d again.
+ CategoryInfo : ObjectNotFound: (CompareCtrlMasterCtrlModelESS:String) [Receive-Job], PSArgumentException
+ FullyQualifiedErrorId : JobWithSpecifiedNameNotFound,Microsoft.PowerShell.Commands.ReceiveJobCommand
Regards
Naveen
You run Start-Job -Name "CompareCtrlMasterCtrlModelESS" in a loop, so you try to create multiple jobs with the same name. Try Start-Job -Name "CompareCtrlMasterCtrlModelESS$i" (with ordinal suffix).