Thanks joey, I am using the below commands from Jenkins but getting errors.
Set-ExecutionPolicy RemoteSigned
Import-Module PowerShellGet
Install-Module -Name PSApigeeEdge -Force
Import-module PSApigeeEdge
Set-EdgeConnection -org def -User xyz-EncryptedPassword abc
Deploy-EdgeApi -Name proxy-name -Environment digital-dev -Revision 25 Error: ConvertTo-SecureString : Input string was not in a correct format.
At C:\Program Files\WindowsPowerShell\Modules\PSApigeeEdge\Public\Set-EdgeConnection.ps1:97 char:35
+ $SecurePass = ConvertTo-SecureString -String $EncryptedPassw ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [ConvertTo-SecureString], FormatException
+ FullyQualifiedErrorId : System.FormatException,Microsoft.PowerShell.Commands.ConvertToSecureStringCommand
There is another tool you can use if you are comfortable with powershell.
https://github.com/DinoChiesa/Edge-Powershell-Admin
The powershell module will need to be imported in order to work with the module, which is pretty simple in jenkins.
ADT can help deploy apiproxies/shared-flows. It has detailed documentation on setting up and using the tool.
Related
Any help is appreciated.
I am getting the error below when trying to execute the PowerShell script in Runbooks.
Invoke-ASCmd : The term 'Invoke-ASCmd' 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. At line:27 char:1 + Invoke-ASCmd -Query $TmslScript -Server: $XmlaEndpoint -Database $Dat ... + ~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Invoke-ASCmd:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
But when I execute the same script locally then it is successful.
Powershell executed locally
I tried to install the SqlServer module using the script:
Install-Module SqlServer -RequiredVersion 21.1.18230 -Scope CurrentUser -SkipPublisherCheck -AllowClobber -Force
but it gave me the errors below.
Error 1:
Exception calling "ShouldContinue" with "2" argument(s): "A command that prompts the user failed because the host program or the command type does not support user interaction. The host was attempting to request confirmation with the following message: PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or 'C:\Users\Client\AppData\Roaming\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install and import the NuGet provider now?" At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7455 char:8 + if($Force -or $psCmdlet.ShouldContinue($shouldContinueQueryMessag ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : HostException
Error 2:
Install-Module : NuGet provider is required to interact with NuGet-based repositories. Please ensure that '2.8.5.201' or newer version of NuGet provider is installed. At line:12 char:1 + Install-Module SqlServer -RequiredVersion 21.1.18230 -Scope CurrentUs ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [Install-Module], InvalidOperationException + FullyQualifiedErrorId : CouldNotInstallNuGetProvider,Install-Module
So, I tried to install the NuGet package using the script:
Install-PackageProvider -Name NuGet -Scope CurrentUser -Force
but it gave me the error below:
Install-PackageProvider : No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags. At line:11 char:1 + Install-PackageProvider -Name NuGet -Scope CurrentUser -Force + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (Microsoft.Power...PackageProvider:InstallPackageProvider) [Install-PackageProvider], Exception + FullyQualifiedErrorId : NoMatchFoundForProvider,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageProvider
I tried installing the following scripts in succession hoping to resolve the issue:
PowerShell Install-PackageProvider -Name NuGet -Scope CurrentUser -Force
PowerShellInstall-Module SqlServer -RequiredVersion 21.1.18230 -Scope CurrentUser -SkipPublisherCheck -AllowClobber -Force
PowerShellInvoke-ASCmd -Query $TmslScript -Server: $XmlaEndpoint -Database $DatasetName
Error running the PowerShell script in Runbooks:
Reasons for error:
Need to check:
The term 'Invoke-ASCmd' is not recognized as the name of a cmdlet:
Add/import the required module by opening below path:
Azure Automation account -> Shared Resources -> Modules -> Add a module Search for sql server from PS Gallery and import.
If you are installing module with script, it is not installing properly sometimes. I suggest you add modules and then invoke Invoke-ASCmd command in runbook.
I tried to install SQL Server after importing, but it failed since "Administrator rights" were required.
To resolve this, You can run account as an administrator or assign managed identities.
I used the following command to assign a
'UserAssigned Managed Identity' to the Automation account:
set-azautomationaccount -Resourcegroupname "Jahnavi" -Name "Jahnaviauto" -AssignUserIdentity "/subscriptions/<SubscriptionID>/resourceGroups/Jahnavi/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<UserIdentityName_user>"
Now, I installed using below command and it worked for me successfully:
Install-Module -Name SqlServer -AllowPrerelease -Force -Verbose -Scope CurrentUser
Exception calling "ShouldContinue" with "2" argument(s):
This error can occurs when you have a package installed in the list and attempt to override it with the required version again.
Use Moduleversionoverrides parameter in these cases.
$storageAccount = New-AzStorageAccount -ResourceGroupName $resourceGroup -Name "blobstgaccdemo" -SkuName Standard_LRS -Location $location
New-AzStorageAccount : An error occurred while sending the request.
At line:1 char:19
+ ... geAccount = New-AzStorageAccount -ResourceGroupName $resourceGroup -N ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzStorageAccount], HttpRequestException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Management.Storage.NewAzureStorageAccountCommand
This is a generic error and can occur in more than a few conditions, including when Azure PowerShell is not able to reach/resolve the underlying management REST APIs, or in case of SSL errors.
To get more information about the error, run the PS cmdlet passing the -Debug parameter along, or set $DebugPreference to Continue before executing the cmdlet. This would surface the details of the exception along with the stack trace.
If this is consistently happening with other cmdlets as well, then you could try upgrading PS modules, or re-installing Azure PowerShell itself. Another quick alternative would be to use Azure Cloud Shell that is preconfigured with all the required modules.
I am following documentation https://learn.microsoft.com/en-us/azure/active-directory/b2b/direct-federation on Powershell and running below command:
Import-Module AzureAD
Connect-AzureAD
$federationSettings = New-Object Microsoft.Open.AzureAD.Model.DomainFederationSettings
I am getting following error:
PS C:\WINDOWS\system32> $federationSettings = New-Object Microsoft.Open.AzureAD.Model.DomainFederationSettings
New-Object : Cannot find type [Microsoft.Open.AzureAD.Model.DomainFederationSettings]: verify that the assembly
containing this type is loaded.
At line:1 char:23
+ ... nSettings = New-Object Microsoft.Open.AzureAD.Model.DomainFederationS ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand
DomainFederationSettings class seems to be missing
How can I have Microsoft.Open.AzureAD.Model.DomainFederationSettings loaded and execute command $federationSettings = New-Object Microsoft.Open.AzureAD.Model.DomainFederationSettings
at the time of writing this answer, you need to use AzureADPreview module and not AzureAd
I highly suspect you are trying this statement with the latter rather than the former.
To install
Install-Module -Name AzureADPreview -AllowClobber
(-AllowClobber is to allow the installation side-to-side with AzureAD module, if you have it installed)
To configure direct federation in Azure AD using PowerShell
Install the latest version of the Azure AD PowerShell for Graph module
(AzureADPreview). (If you need detailed steps, the quickstart for
adding a guest user includes the section Install the latest
AzureADPreview module.)
Source :
MS docs - Configure direct federation in azure ad using powershell
Unable to run windows update remotely via powershell
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module -Name PSWindowsUpdate -Force
Import-Module -Name PSWindowsUpdate
Install-WindowsUpdate -KBArticleID KB890830,KB2267602 -Confirm:$false -AutoReboot
Error Message :
Install-Module : The term 'Install-Module' 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.
At C:\Packages\Plugins\Microsoft.CPlat.Core.RunCommandWindows\1.1.5\Downloads\s
cript4.ps1:3 char:1
Install-Module -Name PSWindowsUpdate -Force
+ CategoryInfo : ObjectNotFound: (Install-Module:String) [], Comm
andNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Looks like Windows Management Framework is missing at the target server. Please install it and try again
Windows Management Framework
Thanks,
Manu
I'm trying to add a new secondary cert to the service fabric, however I receive the following error. does any one have any pointers?
PS C:\WINDOWS\system32> Add-AzServiceFabricClusterCertificate -ResourceGroupName '******' -Name '********' -SecretIdentifier '*************'
Add-AzServiceFabricClusterCertificate : Object reference not set to an instance of an object.
At line:1 char:1
+ Add-AzServiceFabricClusterCertificate -ResourceGroupName '****
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Add-AzServiceFabricClusterCertificate], NullReferenceException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ServiceFabric.Commands.AddAzureRmServiceFabricClusterCertificate
I could not reproduce your issue, it works on my side.
Try to update the Az.ServiceFabric with the command below, my version is 2.0.1.
Update-Module -Name Az.ServiceFabric -Force
In azure keyvault, I use a self-signed certificate, make sure you use the SecretIdentifier below.
Then use the powershell and check the result in the portal.
Add-AzServiceFabricClusterCertificate -ResourceGroupName '<group-name>' -Name 'joyfabric' -SecretIdentifier 'https://joykeyvault.vault.azure.net/secrets/cer135/23c6706daeab47e59caca2431ad96a1c'