Access denied error in Azure devops CI CD deployment - azure-devops

Below are the detailed steps which i am performing for CI CD created pipeline to create spkg.sppkg its successful now in release i am doing below steps
Connect to SharePoint App Catalog (Successful)
o365 login https://naxis007.sharepoint.com/sites/Wipro%20App%20Catalog/AppCatalog --authType password --userName $(username) --password $(password)
Add Solution Package to App Catalog **(getting error access denied in this steps)**
o365 spo app add -p $(System.DefaultWorkingDirectory)/Test/drop/drop/sharepoint/solution/spfx.sppkg --overwrite --appCatalogUrl https://naxis007.sharepoint.com/sites/Wipro%20App%20Catalog/AppCatalog --scope sitecollection

It looks like you were running o365 login command and o365 spo app add command in two separate command line tasks.
Each command line task will open a new terminal window which will be closed when the task is finished. So the login information in the first command line task cannot persist in the second command link task. That's why you got the access denied error.
You should run the o365 login command and o365 spo app add command in the same command line task. So that both the commands will be executed in the same terminal.
Or you can use the task SharePoint Files Uploader to upload the spfx.sppkg file .

Related

Azure Command doesn't create AD User in Powershell

I am attempting to use the Azure CLI to create a user in my Active Directory. I am using this command:
az login
az ad user create --display-name "John Doe" --password "dfdfsd34!234" --user-principal-name "john#mydomain.com" --force-change-password-next-login true --mail-nickname "Jonny"
(I have obfuscated the UPN name)
If I run that from my command line, it runs exactly how I wish and the user appears in my Active Directory. If I place that command inside a Powershell script it fails, saying the UPN is invalid.
az : ERROR: Property userPrincipalName is invalid.
My version of Powershell is 5.1.14409.1005
Any ideas what I am missing? I originally assumed it's correctly logging into Azure, but then returning to the original shell?
When we use the Azure CLI command az ad user create to create Azure AD user, please ensure you have provide a validated Azure AD domain. If the domain is not validated, you will get the above error. The default domain is ***.onmicrosoft.com For more details, please refer to here and here
For example
az ad user create --display-name "John Doe" --password "dfdfsd34!234" --user-principal-name "john#hanxia.onmicrosoft.com" --force-change-password-next-login true --mail-nickname "Jonny"

Powershell script with "az webapp create-remote-connection" pauses at this instruction

I'm attempting to script a backup process of a docker volume hosted in a azure linux app service.
I need to create a ssh tunnel using powershell. Calling the script from task scheduler with the following powershell -noninteractive -File R:\path\to\ftp-backups.ps1
When the following command is executed to create the tunnel
az webapp create-remote-connection --subscription 00000000-9dfs-4fdsxexxxx-324jklsdf4308320324 --resource-group my-resource-group -n my-app-name -p 12345
The powershell dialog that has come up offers the interactive options of
Opening tunnel on port: 12345
SSH is available { username: user, password: password }
Ctrl + C to close
The script does not move past this point, how can I suppress this interactive dialog prompt so the rest of the script will continue?
I responded to your question on a different forum. Posting here for visibility
The engineering team revamped this command recently which was deployed as part of CLI release 2.8.0. The PowerShell script should work now.
https://github.com/MicrosoftDocs/azure-docs-cli/blob/master/docs-ref-conceptual/release-notes-azure-cli.md#appservice-1

How to use PowerShell as admin on Hyper.js

I'm trying to use PowerShell with Hyper.js. I have this on the hyper config file:
shell: 'powershell.exe',
shellArgs: ['']
This way PowerShell is loaded as non-admin, and I receive an error because I don't have a PowerShell profile file configured, but I have a profile for admin user, I want to configure Hyper.js to use PowerShell as admin.
It's not the best solution, but you can run Hyper as admin
https://github.com/zeit/hyper/issues/1752#issuecomment-427086434
There are some other solutions in the linked issue.

Jenkins windows slave batch job says success but job did not run

Trying to set up a jenkins v2.46.3 slave on windows 2016 server to run a batch file.
It looks like it is working but the batch file does not actually run. The script does not generate the expected log file and nothing shows up in task manager on the slave
The console output of the job looks like this:
Started by user xxx
Building remotely on xxx-Windows (windows) in workspace c:\Jenkins\workspace\xxx
[xxx] $ cmd /c call C:\Windows\TEMP\hudson4948156451026881586.bat
c:\Jenkins\workspace\xxx>C:\QA\xxx\Perl\Tests\runxxxTests.bat
c:\Jenkins\workspace\xxx>cd C:\QA\xxx\Perl\Tests
C:\QA\xxx\Perl\Tests>runxxxTests.pl -f test_suite_test.list
Finished: SUCCESS
If I run the batch file manually it works as expected.
There do not seem to be any errors. How can I troubleshoot this further ?
The fix to this was changing the log on rights of the Jenkins and Jenkins Agent services on the windows slave from LocalSystem to a privileged account.

prepare AD command of power shell is stuck in copy of files in first time

I run below powershell command through psexec for prepare Active Directory for install exchange server:
.\Setup.exe /PrepareAD /OrganizationName:$Exchange_org_Name
/IAcceptExchangeServerLicenseTerms
But, it got stuck in first time during copy of files. When I run same command manually then its working fine. It prepared AD successfully.