I've been running Visual Studio as admin for a few years now. As of today, my user account no longer has admin rights. Rather, I have a second account that has elevated privileges. The problem I'm running into is that if I run the application now with my second account, all my TFS mapping, applications settings, history are all tied to my original account. I have web projects that won't load if I'm not admin, and show as locked by another user if I log in with my Admin account.
So, rather than taking the obvious, and lengthy, route of checking in all files and basically getting rid of all TFS mappings from my original account and then maintaining two user accounts, I'm hoping for a way to develop without having to use my admin account.
Is this possible? Can I develop website (currently the won't load) if I run without admin rights?
On the start menu Right Click on your visual studio icon. In the bottom Application Bar that appears, click "Run as Administrator".
Related
So here is the setup. This is for Cyber Essentials (and Cyber Essentials plus).
We have a product that requires local admin access to run. We need to log into the PC as a non admin. So first of all I have done the devenv.exe trick for compatibility to mark it as 'run as admin'. So when we run Visual Studio it will now prompt to enter login details of an admin user. I enter the details of my 2nd user who is a local admin on the machine.
Visual Studio 2022 starts and I get the admin badge in the corner. Our product runs (it's running under the other user) successfully, but I have a problem with areas of the product that launch in a web browser.
First of all, any process.start(url) style command will run (without any errors or events in event viewer) except the web browser just doesn't appear.
Also, manually selecting a web project in the solution and running it will run IIS express except again, it will not open the web browser (there is a workaround to this in that I can open the browser myself and grab the localhost:port address from the IIS Express system tray icon).
But basically running in this scenario, no projects can open a browser. Anyone else come across this and have a solution? Thank you.
In VS2017, VS2019, and VS2022 our developers have been having significant issues with Visual Studio logging in with their company emails (Office 365 accounts - Visual Studio access granted that way).
This is encountered in both the Visual Studio Account Settings pane and the Azure New Publish Profile window. They successfully log in (uname, pword, and 2FA), and then within a second or two they are asked to re-enter credentials. We have seen this happen frequently over the past year or so over multiple VS versions (both before and after fresh installs), multiple computers (both before and after a complete windows wipe and reinstall), and with every developer on staff. (I personally have seen it happen upwards of 8 times in a row before the program decided to keep it).
Does anybody know what is going on with this, and if there is any way to stop (or even mitigate - we'll take what we can get at this point) this from happening?
Example "Re-Enter Credentials" screen shot
Do the accounts have access to multiple tenants which also have 2FA? From my experience the re-enter credentials loop is to cycle through tenants which enforce 2FA. If you go to account settings and amend the 'Apply filter...' to just the tenant you are working on then it should only ask for the credentials to be validated once.
try this solution -> https://blog.jongallant.com/2021/08/visual-studio-re-enter-credentials/
if not work, uncheck the checkbox, then try again (this solved my problem)
Is there an option in the application properties ? I cannot find anything that tells Visual Studio that my application will need to be run in an elevated state.
If you're just trying to do this on your development machine, you could:
Log in as the Administrator and run Visual Studio
-OR-
Right-click the Visual Studio shortcut and click "Run As" and supply the Administrator account credentials.
If this is for an application you are developing to live on a server where the server cannot be left logged in as an Administrator while your application runs, you should either:
Build in impersonation into the code of the application, so it will run as whatever account you want it to run under
Give that account Administrator privileges (if allowed) or choose an account that already has the desired privileges for the WindowsImpersonationContext.
Info on Impersonation:
MSDN Windows Impersonation Code
Code Project Example
StackOverflow Impersonation Question/Example
Without information about your app, i.e. if it is a web app or standard exe or SharePoint web page, it's hard to give you more specific info. For .NET web apps, ensure you use Windows authentication and set your app pool to run under the account with Admin privileges. Note that you may still need to add the Impersonation code into your app where you need the higher privileges, even if it is running under that account.
For SP pages, you need SPSecurity.RunWithElevatedPrivileges(function(){ ... });
I'm having this exact problem:
Visual Studio requires elevated permissions in Windows 7
But I'm not really happy with any of the answers there so I was wondering if someone could expand on an alternative solution.
Setup
dev box is running server 2008
Visual Studio 2010
IIS 7
In order to attach to a process running under IIS, I am being told I need to run Visual Studio as an administrator. If I do this, whenever I edit and check a file into source control the other users (who are not administrators) can't edit the file because the FILE now needs elevated permissions to edit! Causing massive headaches, so basically running VS as admin doesn't appear to be an option.
Does anyone have any alternatives?
Attaching to process which runs under different user credentials or higher integrity level requires SE_DEBUG privilege which application obtains when running as administrator. Your IIS AppPool is most likely not configured to run under your account hence the requirement for elevated permissions.
Starting from Windows Vista SE_DEBUG privilege is disabled for processes not running as admin (or more precisely, not running with high integrity level).
From MSDN:
Certain administrative Windows privileges can be assigned to an access
token only with at least a high integrity level. If the access token
integrity level is less than high, then specific administrative
privileges are not allowed and are removed from the access token. The
administrative privileges associated with a high integrity level are:
...
SE_DEBUG_PRIVILEGE
...
And fruther from here:
SeDebugPrivilege - Required to debug and adjust the memory of a
process owned by another account. User Right: Debug programs.
If you go to properties on your website project, then click on the 'web' tab, then choose the option 'Use local iis web server', you can then debug 'as normal'. That works for us without elevated permissions.
Bit late in the game here, but I've found if you install Remote Tools for Visual Studio and install it locally, you can then attach to w3wp.exe without having to run under elevated permissions!
To give this privilege
1) Run GPEDIT.MSC from command prompt.
2) Navigate to
Local Computer Policy -> Computer Configuration -> Windows Settings ->
Security Settings -> Local Policies -> User Right Assignment -> Debug
programs and add users to it.*
*You should also be aware of If you grant somebody SeDebugPrivilege, you gave away the farm
http://social.msdn.microsoft.com/Forums/en-US/0f394922-4d3d-4c00-8bc1-88aeeeedd843/how-to-add-a-user-to-debug-users-group?forum=netfxbcl
Update:
This not works too.
The alternative is, as describe on book "Professional Visual Basic 2012 and .NET 4.5 Programming": Go to the bin/debug folder and manually start the ProVB2012_Security.exe executable outside of debugger. But in either case you should now be prompted to grant administrator rights...
My main domain account does not have local admin privileges and I start Visual Studio using RunAs and another account that has local admin privileges.
Our Team Foundation Server (2008) is configures to recognise the main domain accounts not the local admin accounts. This means I have to log into TFS after starting VS with the admin account. Note that TFS is on our domain and it's VS that is prompting for credentials.
Is there any way I can automate the logon to TFS to use my main domain account?
Pro tip: Log into the TFS server's website with IE. Check remember password. Now it will remember it from VS :)
I would suggest that either you have the local-admin-wielding account added to TFS (if it isn't a shared account, that is), or you log in as local admin, and add your main domain account to local administrators. It's either that, or you'll need to log in to TFS every time, I believe.
Also, it's not Visual Studio that is prompting you for credentials, it is Team Foundation Server. Basically, when TFS tries to make the connection to TFS, it tries to log on with your current network credentials. If that doesn't work, it will bring up the appropriate dialog(s) to prompt for user id and password.
Have you tried
http://runas-professional.software.informer.com/
Login to the machine as the administrative user.
Then either login to the TFS webserver, or (on win7) go to:
Control Panel -> User Accounts -> User Accounts -> Manage you credentials
add the information here.