Why can't I re-authenticate (MFA with mssql extension for VS Code)? - sql-server

Here's an example of a connection configuration that has stopped working (it's for connecting to an Azure managed database):
{
"server": "sqldb.12345abcde.database.windows.net",
"database": "sqldb01",
"authenticationType": "AzureMFA",
"profileName": "sqldb01",
"azureAccountToken": "",
"expiresOn": 1648022420,
"email": "benmcf#work.com",
"accountId": "aaaaaaaa-0000-bbbb-1111-cccccc222222"
}
When I try to connect, VS Code displays a dialog saying mssql: Credential Error: Account credentials have expired. Please re-authenticate. and another saying mssql: undefined:
After clicking the refresh credentials button, the linked page fails to resolve in my browser, showing ERR_CONNECTION_REFUSED:
When I reinstall the plugin, remove my connection definitions from settings.json and attempt to create a new connection, the browser page resolves correctly and allows me to authenticate, but it has no effect in VS Code.
I'm able use the same connection details in Azure Data Studio to connect successfully.

I had the same/similar problem and found 2 possible issues in my case. I went into Windows Credential Manager and Removed the aad-iv and aad-key credentials, as well as all the others that did not say Modified: Today (presumably overkill).
When I then tried again in VSCode, I received an error but was able to proceed by it giving me a chance to enter credentials. In my case, it then failed to connect with an option to automatically add a firewall rule... and then everything worked.
I'm not sure if it wasn't smart enough to figure out how to refresh credentials OR if it was trying to but something with the firewall rule came into the picture and disrupted it.
After this, I noticed Windows Credential Manager had aad-iv and aad-key credentials added back. So... I would try removing just those 2 and see what happens.

I resolved this by deleting the contents of this folder (Mac): ~/Library/Application Support/vscode-mssql/AAD.
I believe the equivalent on Windows would be something like C:\Users\{username}\AppData\Roaming\vscode-mssql\Azure Accounts.

I did the same as benmcf. However, I also deleted the AAD folder:
C:\Users\{user}\AppData\Roaming\vscode-mssql\AAD
After it, I uninstalled the MSSQL extension and installed again. Then it worked.

Related

Visual Studio Code - Type Script - Unable to load tsconfig.json and packages.json schemas

I'm working on an Angular front end in Visual Studio Code for an app with a C# windows service back end. After spending a few days on the back end without touching the front end, I found that Visual Studio Code would no longer automatically recompile my typescript code every time I saved. Instead, I would have to ctrl+c out of the process and run "npm start" again.
I ensured that compileOnSave was set to true in my tsconfig.json. In doing so, I notice a warning:
Problems loading reference 'http://json.schemastore.org/tsconfig': Unable to load schema from 'http://json.schemastore.org/tsconfig': Unable to to connect to http://json.schemastore.org/tsconfig. Error: getaddrinfo ENOTFOUND json.schemastore.org json.schemastore.org:80
I noticed a similar warning for packages.json. I'm able to load the schema on the links on Google Chrome.
What could be a possible fix? Could I download the schema and load it in Visual Studio Code manually?
For me it wasn't the proxy blocking, but trusted domain list in VSCode.
Go to "Manage trusted domains" on Command Palette and add required url. Here we can add "http://json.schemastore.org"
This is whitelist for VSCode, as a security feature, stopping it running code from anywhere from internet.
Update:
Seems a network issue for me. When I set Http: proxy correctly it disappeared and json schema works well.
Go to "Settings" > "JSON" > "Schema Download" and disabled it.
That's worked for me.
The solution, as pointed out by #Matt Bierner in the comment above, is to set the "$schema" key to direct to a local schema file (which can be downloaded from the address in the error).
The problem seems to be caused by a web proxy. Why it showed up now is still unknown.
just follow these simple steps
click on the Settings icon at the bottom left of your vscode
search for JSON
you should see the schema download, it should be enabled
just turn it off
This worked for me.

Cannot login to Oracle Enterprise Manager Express

I have downloaded Oracle Developer Days Database 12c virtualbox image. I can boot it and access the desktop. When I try to log in to Enterprise Manager (EM) Express using the URL http://127.0.0.1:8888/em I am asked to install Adobe Flash. I install it and get to the login screen.
If I try to login as SYSTEM I get the following error:
But when I try to log in as user SYS I get a strange error: Security token does not match. You must login again..
To me it looks like the credentials for SYS are OK, but there is something wrong with the user in the database. Is this correct and if so how can I fix it? Or is EM Express just not setup on the image?
This document from Oracles Metalink solves it. The solution contains 3 steps:
Make sure that XDB_WALLET is recreated successfully.
Make sure XDB is installed successfully and the appropriate roles, EM_EXPRESS_BASIC/ALL is applied.
Use IE 11.0.9600.16476 with compatibility view.
Mark Stewart's answer covers step 2.
The first two steps are not strictly necessary. It looks like they have already been applied to the image in my case. All I had to do was use a different browser. Opera, Chrome, and IE all worked, but Firefox didn't.
The fact that Oracle installs a browser that doesn't work with EM Express and that Adobe Flash is not installed when it's required is very strange.
Set up a personal user ID, grant DBA to it, and try granting EM_EXPRESS_ALL role to your user ID.
After making sure that a desired account has EM_EXPRESS_ALL granted I just accessed Enterprise Manager using New Private Window in Firefox.
In Microsoft Edge, no problem accessing Oracle 12c EM
In Microsoft IE 11, no problem accessing Oracle 12c EM
In Firefox : Security Token does not match
Found a solution for Firefox on Is there a way to make Firefox ignore invalid ssl-certificates?
Go to Tools > Options > Advanced "Tab"(?) > Encryption Tab
Click the "Validation" button, and uncheck the checkbox for checking validity
Be advised though that this is pretty unsecure as it leaves you wide open to accept any invalid certificate. I'd only do this if using the browser on an Intranet where the validity of the cert isn't a concern to you, or you aren't concerned in general.
I faced this because of the cookie data stored by Adobe Flash. Browsing on Private mode or Incognito did not help. Here are the steps to remove the stored data and start using EM on Chrome:
Go to Settings>Advanced>Content Settings>Cookies
Coose See all cookies and site data
In the cookies search box, key in the hostname used to access EM. I run EM on my localhost and hence filtered by localhost:
You can see Flash data being listed
Click on the item to expand and delete the item related to EM:
The same error still exists in 2019 on EM with Chrome Version 76.0.3809.87. My solution is to add EM URL to the "Allow" section in the Cookies section.
Use internet explorer to login to EM .
The other browser are not compatible with enterprise manager

Having issues getting WordPress running under GAE + Cloud SQL

I tried to set up WordPress under Google App Engine earlier tonight (following the instructions here: https://developers.google.com/appengine/articles/wordpress).
It runs fine locally, but when I push to remote I get a database error (visible at https://wp-dot-frontiermediag.appspot.com/). If we throw on a /wp_admin/install.php you get:
This either means that the username and password information in your
wp-config.php file is incorrect or we can't contact the database server
at :/cloudsql/frontiermediag:fmwp. This could mean your host's database
server is down.
Here's the relevant code in wp-config:
/** MySQL hostname */
if(isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'],'Google App Engine') !== false) {
define('DB_HOST', ':/cloudsql/frontiermediag:fmwp');
}else{
define('DB_HOST', 'localhost');
}
frontiermediag:fmwp is showing "Status Runnable" in Developers Console > Cloud SQL.
I did this once before and it worked so I'm not sure what I'm missing here. I thought it might have been because I'm using WP 3.8.1. but rolled back to 3.5.1 and same thing's happening.
Any ideas? frontiermediag is listed as an authorized application on the :fmwp ACL.
This situation happened to me earlier.However, I edited my Cloud SQL instance , and set "Preferred Location" as "Follow App Engine App" from Google Developers Console. This database connection problem was solved in my case.
I tried the instructions with wordpress 3.5.1 and the instructions seem to work for me. The code snippet you have above seems right and I am not sure what could be wrong without looking at rest of your code. Can you try the instructions from the beginning one more time with 3.5.1?
I had this issue, because "Follow App Engine App" doesn't seem to be an option for second generation instances in my case, and so the instance connection name includes the region setting.
Look at the instance details, and under properties, find "Instance connection name". That is the text that should follow :cloudsql/.

An error occurred while signing

I maintain a large WPF application which I inherited from another developer. I use ClickOnce to publish it. Suddenly, today I got an error message:
Error 2 Cannot publish because a project failed to build. 1 1
Error 3 An error occurred while signing: Failed to sign bin\Debug\app.publish\setup.exe. SignTool Error: No certificates were found that met all the given criteria.
I do have a file called SomeName.snk, which is referred in project settings, Signing tab. I have no idea what happened today that caused the problem.
I use VS 2012.
Go to main project properties > Signing > If the expiration date is over > click on Create Test Certificate, password is not mandatory, and you're done.
I'd check whether the certificate expired. Most (all?) certs have an expiration date.
I got this problem installing visual c++ on top of a VS2017 .net install. I solved it by unchecking Properties -> Security -> Enable ClickOnce security settings.
It then created an app.manifest file. After that the error went away. Interestingly enough, I checked it again to see what would happen and the problem did not come back.
Did you check for the certificate?
View or manage your certificates
You can use the MMC Snap In or Internet Explorer.
Go to main project properties > Signing > Select from Store...
Click certificate properties
And install certificate
Go to Main project (Startup Project) and right click > properties
Then go to Signing
Then unchecked "Sign the ClickOnce manifests"
It's work for me.
This happens mostly if your certificate for that particular project has expired or has some issues.
Right Click Project -> Properties -> Signing Tab -> More Details button -> Shows your certificate details. Check if your certificate has expired
Ways to Fix
1. Un-check the "Sign the ClickOnce manifests" and try
2. Extend the Certificate by creating a Test Certificate (If your certificate is expired)
Hit "Create Test Certificate..." button
Enter your credentials (Not mandatory)
Save
3. Re-validate your existing certificate (If your certificate is not expired)
Hit "Select from file" button and use your existing key file (eg. .pfx)
OR
Hit "Select from Store" button and select from the available options
Tip: If you still face issues building the project. Just restart your
Visual Studio.
Hope that helps.
I had this same issue and I was able to solve it by removing or changing the timestamp server URL. After removing that, the project was able to build successfully.
I just ran into the problem today. In my particular case, it was caused by this Microsoft Windows Update.
I uninstalled that update and publish began working as it always had. This is only a temporary work around and means you should probably regenerate your keys/certificates.
In my case, the cert was not expired and none of the other solutions worked (restarting VS, using a temp test cert, restarting computer, etc.)
The issue was resolved by deleting my output directory and rebuilding.
Simple Clean sorted it for me.
Build - Clean Solution
In my situation I had many projects in the solution, so I browsed to the non-startup project and:
Go to main project properties > Signing > uncheck the Sign the ClickOnce option
Using Visual Studio 2019

Parser: The syntax for the ImpersonationInfo object is incorrect, If the ImpersonateAccount value is used for ImpersonationInfo

I am trying to deploy a cube for the first time on my PC. I have run SSMS as an Admin and made myself (Gary-pc\gary, using Windows authentication) an admin. Doing this got me past the error message user does not have permission to create a new object in 'GARY-PC', or the object does not exist.
When I deploy the cube now, I get the error: the syntax for the ImpersonationInfo object is incorrect. If the ImpersonateAccount value is used for ImpersonationInfo, then the Account property cannot be empty.
I have not (knowingly! LOL) set up anything related to impersonation.
I've resolved the problem with this:
Double click on data source
Select impersonation
Choose use credentials of user
As #user1335419 says.
I tried changing the impersonation to "Credentials of User" and although I was successful in deploying the cube, I could not process it. I ended up getting an error that said:
"The datasource contains an ImpersonationMode that is not supported
for processing operations"
So I changed the impersonation from "Credentials of User" to "Inherit" and was able to process. I don't know if the first deployment would have worked with "Inherit", but thought I would share my experience.

Resources