Azure login using a .publishsettings file - bash

I'm trying to assign a reserved IP to a VM using the CLI tools.
After running $: azure network nic set [
pawel#LAMP-Test:~$ azure network nic set LAMP-Test FirstReservedIP
info: Executing command network nic set
error: The current cmdlet requires you to log in using Azure Active Directory account, not from a .publishsettings file. Please run 'azure login' or use 'azure account set' to select a correct subscription.
info: Error information has been recorded to /home/pawel/.azure/azure.err
error: network nic set command failed
info: Executing command network nic set
error: The current cmdlet requires you to log in using Azure Active Directory account, not from a .publishsettings file. Please run 'azure login' or use 'azure account set' to select a correct subscription.
info: Error information has been recorded to /home/pawel/.azure/azure.err
error: network nic set command failed
azure network nic set LAMP-Test FirstReservedIP
]1 FirstReservedIp
I received following error:
The current cmdlet requires you to log in using Azure Active Directory
account, not from a .publishsettings file. Please run 'azure login' or
use 'azure account set' to select a correct subscription.
Is there a way to use .publishsettings file only to achieve this task?

No, at least not when you are in ARM mode. Using the .publishsettings file to authenticate from the CLI tools is only supported in the ASM mode.
More information available here.
You can still achieve a non-interactive login using CLI but it will require that you authenticate to Azure AD using a Work/School account (aka Organizational account). So, create an admin user (or service principal) in your Azure AD if you don't already have one. Then, add the azure login command to the top of your CLI script. For example...
azure login --username johndoe#contoso.onmicrosoft.com --password passw0rD!
azure network nic set LAMP-Test FirstReservedIP

Related

Certificate Error when trying to Configure SSS on CRM on-premises for Exchange Online

I'm using this article https://learn.microsoft.com/en-us/previous-versions/dynamicscrm-2016/administering-dynamics-365/mt703269(v=crm.8)?redirectedfrom=MSDN for configuring CRM on-premise server based authentication a.k.a SSS (Server Side Sync) to Exchange Online.
Under the section: Set up server-based authentication, Step 2 the first part of the command works fine.
Command:
$CertificateScriptWithCommand = “.\CertificateReconfiguration.ps1 -certificateFile c:\cert.pfx -password mypasswordhere -updateCrm -certificateType S2STokenIssuer -serviceAccount domain\serviceaccount -storeFindType FindBySubjectDistinguishedName”
It's the second part that fails with the error.
Command: Invoke-Expression -command $CertificateScriptWithCommand
Error:
D:\Program Files\Microsoft Dynamics CRM\tools\CertificateReconfiguration.ps1 : Cannot bind argument to parameter 'password' because it is an empty string.
Any ideas on what I need to investigate to resolve this problem would be greatly appreciated...thanks
I tried various things I found online such as:
granting service account access to certificate private key
granting service account local security policies for log on as a service and log on as a batch job
granting service account local administrator on CRM server

How to set a login user account for a windows service written in Golang?

I use the package "https://pkg.go.dev/github.com/kardianos/service" to run an application written in Go as a Windows service.
I set the following attributes in service.Config:
Username: "myusername"
Option: service.KeyValue{"password": "mypassword"}
When I then install the program, I get the following error: The account name is invalid or does not exist, or the password is invalid for the account name specified.
How should I set attributes of service.Config to make the service run properly with specified the credentials when installed?
I just found out the solution myself.
Username:`DESKTOP-XXXXXX\myAcount`
Option: service.KeyValue{"password": "mypassword"}

How to include domain user in Jenkins Job execution

I am automating a build process. The process requires deployment of application to a server, after deployment a few scripts have to be executed to share and provide permissions on the server. The scripts run when I login via domain user through powershell.I am using Jenkins for the CI/CD process. I want to include my domain credentials to run the scripts on the server. I have also used the active directory plugin, and can login with my domain credentials but still I am not able to establish a remote connection with the server.
My script is
Enter-PSSession -ComputerName ATKT-WS-20
Invoke-Expression -Command .\FolderSharingScript.ps1
Enter-PSSession : Connecting to remote server ATKT-WS-20 failed with the following error message : WinRM cannot
process the request. The following error with errorcode 0x8009030e occurred while using Kerberos authentication: A
specified logon session does not exist. It may already have been terminated.
Possible causes are:
-The user name or password specified are invalid.
-Kerberos is used when no authentication method and no user name are specified.
-Kerberos accepts domain user names, but not local user names.
-The Service Principal Name (SPN) for the remote computer name and port does not exist.
-The client and remote computers are in different domains and there is no trust between the two domains.
After checking for the above issues, try the following:
-Check the Event Viewer for events related to authentication.
-Change the authentication method; add the destination computer to the WinRM TrustedHosts configuration setting or
use HTTPS transport.
Note that computers in the TrustedHosts list might not be authenticated.<
I have also added the machine name in the trustedhosts. How can I include the domain credential in Jenkins jobs?
The solution turned out to be not to use PowerShell's remoting at all, but instead rely on the remoting built into Jenkins:
Connect the remote machine as a Jenkins agent to the Jenkins server, running the agent executable as the desired domain user.
On the Jenkins server, ensure that your job is configured to run on the remote machine, using a label expression.
Assuming the PowerShell plugin is installed, you can then send PowerShell code as-is to the remote machine - no need for PowerShell sessions, credentials, ...

hyper-v rollback with login error: The trust relationship between this workstation and the primary domain failed

Today I try to rollback one hyperV vm which is domain joined.
When it is rolled back and started, it displays following error:
The trust relationship between this workstation and the primary domain
failed.
I tried solution to log off domain and rejoin domain. It throws following error:
"computer name is already existing in domain"
I also tried solution from following post:
http://implbits.com/About/Blog/tabid/78/post/don-t-rejoin-to-fix-the-trust-relationship-between-this-workstation-and-the-primary-domain-failed/Default.aspx
http://support.microsoft.com/kb/325850
with command to sync account password:
netdom resetpwd /s:server /ud:domain\User /pd:*
Throws following mesage:
The machine account password for the local machine could not be reset.
Access is denied.
At last the issue is fixed by:
1.Export target vm snapshot
2.Import exported snapshot
3.Log in to new vm and unregister from domain
4.Rename vm computer name
5.Rejoin to domain
But I do not think it is a good solution
I was seeing this issue running a windows 10 guest on a Windows 10 HyperV. The following fixed it.
Logon to the VM using a local admin account and run powershell and execute
Reset-ComputerMachinePassword -Server [MyDomainController] -Credential
[MyDomain\administrator]

Oracle 12c login credentials for windows built-in user account

J just installed a new copy of Oracle Database 12c Enterprise Edition with following basic install time settings:
Skip software updates
install database software only
single instance database installation
English language
Enterprise edition
use windows built-in account
install path: C:\Oracle\
The installation went smoth without any critical warnings or errors.
After installation when I start SQL*Plus command line it requires me
User Name:
Password:
I have not specified any of these during installation. S, what could probably be the credentials?
I tried using my windows log-in user & password to login (Nte: My windows log-in name has a white space in middle as: FirstName LastName) but it issued me an ERROR message as:
Enter user-name: ******* ********
SP2-0306: Invalid option.
Usage: CONN[ECT] [{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM|SYSBACKUP|SYSDG|SYSKM}] [edition=value]]
where <logon> ::= <username>[/<password>][#<connect_identifier>]
<proxy> ::= <proxyuser>[<username>][/<password>][#<connect_identifier>]
Then I tried using same user name without white space but got another Error message as:
Enter user-name: ***************
Enter password:******
ERROR:
ORA-12560: TNS:protocol adapter error
Is there anywhere I am going wrong? Please suggest me the solution
Thanks...
My suggestions:
1: First ensure that you have specified ORACLE_SID AND ORACLE_HOME environment variable before trying to login. You can try following commands to set those environment variables:
Put correct path and sid_name for the following commands and insert them system environment variable. Don't forget to check the value of respective environment variable before login attempt.
ORACLE_BASE=C:\oracle;
ORACLE_HOME=$ORACLE_BASE\product\11.2\db_1;
ORACLE_SID=sid_name_here;
PATH=$PATH:ORACLE_HOME\bin;
Now, issue should get resolved if you getting trouble because of environment variable.
2: Next, verify the status of listener. See the output of following commands to confirm the status of listener:
lsnrctl status
lsnrctl services
Above command show the status of listener and associated service. If you didn't see SID and associated service name, You need to start listener service (i.e. from services.msc).
3: Sometimes, you might be getting this issue because of TNS_ADMIN not setup properly. Configure TNS_ADMIN in system environment variable and also mention in the tnsnames.ora file. Refer link for the discussion configuring TNS_ADMIN in windows environment.

Resources