How to write MSBuild Arguments without a username and password when deploying to IIS7 using WMSVC and NTLM Auth? - iis-7

I've been trying to get our web app auto-deployed using TFS/MSBuild with WMSVC. The problem is that I can't use a build script that exposes a password. I'm hoping that I can take the identity that the build server is using to authenticate with WMSVC on my IIS 7.5 machine and get the app deployed with all the web.config goodness that has been promised.
There is another post here that offers work-arounds and states that WMSVC defaults to BASIC auth and to encrypt the password. This isn't something we want to do. Our requirements are to do a deploy without embedding user/pwd into the build scripts.
We want to be able to use NTLM via delegation or adding the build server to the administrator group on the IIS machine.
Is this totally impossible? There is no way to do this without a username and password specified in the build script? I just want the credentials I have already assigned on the IIS side for my build server to work. Any idea if this is just simply wishful thinking?

I believe you are looking for the -authType NTLM flag in the msdeploy command line described here
msdeploy -verb:sync -source:webServer,wmsvc=Server1,authtype=NTLM

Related

Spoof IIS Express App Pool Identity for Integrated Security

In order to keep application secrets out of source code I want to use Integrated Security to connect my ASP.NET MVC application to SQL Server. However, IIS Express uses my development machine's account as the Identity for Integrated Security, which has different permissions from the AppPoolIdentity on production. I want to connect to SQL server using the same permissions in development as in production, which seems like something that should be easy to do, but I have had no luck.
Apparently it is impossible to set the Identity used by IIS Express except using "runas" which I could not get to work: how to run iisexpress app pool under a different identity
Things I've tried:
IIS Express
Create a User in "Edit local users and groups" and add it to "IIS_IUSRS" group.
Create AppPool in IIS Express manager (Jexus manager)
Setting AppPool > ProcessModel > Identity to newly created User, which fails.
(However setting AppPool Identity works in IIS Manager (not express))
Create site and configure path and ApplicationPool
Application successfully launches through Jexus manager, however still using my Windows account like it does launching from Visual Studio
IIS
Create app pool and log in as newly created user (succeeds unlike Jexus manager)
Create and configure site to use https and IIS Express development cert
Get 500 error when trying to launch the same way as with Jexus manager
I would rather launch the app from Visual Studio anyway
Impersonation
Requires credentials in web.config defeating the purpose of Integrated Security
It's important we manage secrets internally so Azure Key vault or other similar 3rd-party solutions are off the table.
It's beginning to seem impossible to configure IIS Express AppPools to use an Identity other than the currently logged in user: Link1 and Link2. The second link describes a method using "runas" from cmd as Admin but using System.Security.Principal.WindowsIdentity.GetCurrent().Name to check the ApplicationPool identity still shows my logged in Identity, not the one I used in the "runas" command.
What are my options? I would like to use Integrated Security for both dev and prod, with the same permissions on each. Is this possible? Is there an equivalent workaround?

IT Hit WebDAV with server side console application

Does anyone know the way to access IT Hit WebDAV Server's files from server side console application?
The DavContext generated inherits DavContextBaseAsync that depends on OwinContext or HttpContext.
Yes, you can mount file system using 'net use' command:
net use https://server/path/
Behind the scenes this command is using mini-redirector driver. After mounting you can use regular file system API and commands to manage the files on a WebDAV server.
Note that:
Your server must use Basic, Digest, NTLM, Kerberos authentication or
be anonymous. It does not support cookies/Forms authentication.
If you are using Basic authentication you need to use SSL/HTTPS or
enable insecure Basic authentication (for testing and dev purposes
only!)
If you are using 'net use' on the Windows Server you need to have
Desktop Experience Windows feature installed. By default this feature
is not installed on Windows Server.

Visual Studio 2015 Debug under a different domain account

I need to run unit tests and test database connections using integrated security with SQL Server for a domain service account that will be the appPoolIdentity when we push to dev and production. I have been trying to find an answer to this for some time and can't seem to get a handle on it. It seems like it should be possible to impersonate this account given userid and password. Any help would be appreciated.
It's relatively simple. Rather than using the integrated IIS Express, you install the full IIS on your local computer, then you assign the app pool the identity of the service account you are going to use.
You do need to run Visual Studio as Administrator in this scenario to debug a different user.
Make sure that you setup the project to use IIS rather than IIS Express, and you should be good to go.

Not able to make an HTTP access to SQL Server Analysis services 2008 on Windows Server 2008 via IIS 7

My intention is to access the SSAS Database without Windows authentication. The user outside the domain should be able to access the cube and built PIVOT tables around it. Thus I found that we can use HTTP access for this purpose.
I followed each and every step mentioned on the following links
http://msdn.microsoft.com/en-us/library/gg492140.aspx
http://bloggingabout.net/blogs/mglaser/archive/2008/08/15/configuring-http-access-to-sql-server-2008-analysis-services-on-microsoft-windows-server-2008.aspx
When I try to hit the URL in Mgmt Studio --> Analysis Services
http://localhost/olap/msmdpump.dll. I am getting the "Connection time out" and "404 error"
I went to MSDN forums for the same problem but no concrete results.
How do I test whether my SSAS 2008 is accessible with HTTP access.
Please help!!
I don't have a lot to go on from your question, but if I had to guess I'd say you probably didn't switch from integrated to classic in the application pool settings which left your handler mapping disabled giving you the 404.
I would start simple on your local development machine and follow the instructions allowing anonymous access to the site. Make sure that your site uses an application pool that has access to the cube in analysis services. Additionally, you cannot use the integrated pipeline in IIS, you will hve to use classic. When you create your script mapping (under Handler Mappings) in IIS, make sure that you follow the directions carefully from the following URL:
http://msdn.microsoft.com/en-us/library/gg492140.aspx
I just followed the instructions and it worked for me.
Switching on Anonymous authentication will work to grant access to the site, however I would suggest you use at least Basic HTTP authentication or even Windows Authentication. Just note, if you're using a remote SSAS instance (not on the same host), a double-hop authentication is required. For that, you will have to register SPNs and enable Kerberos authentication.
You find out how to do that by following the links referred to under
Microsoft - Configure HTTP Access to SSAS
Greetings,
Remo

Connecting to SQL with ANONYMOUS LOGON since switch to IIS7

I've recently had my PC upgraded to Vista, which means it includes IIS7. The problem is that the ASP.NET website we're working on doesn't work anymore. I get an error because the application is trying to connect to the SQL Server with NT AUTHORITY/ANONYMOUS LOGON instead of my domain user, and anonymous isn't authorized. I've tried several things, but no solution yet:
- install and enable the 'IIS Metabase and IIS 6 configuration compatibility'
- enable Windows Authentication for this website
- created a different Application Pool with managed pipeline mode set to Classic
- enabled IIS6 WMI compatibility and IIS6 management console (getting desperate here)
In our web.config there's and in our machine.config there's . I've tried putting impersonate to false and entering my domain user and password in the machine.config (it used to be like this) but that didn't help either.
Are there things I'm missing? Has anyone else had a similar problem?
How does your application authenticate with SQL Server? Does it use SQL or Windows Auth? I hope you are trying to use Windows Auth. In that case, your IIS worker process should be running under that Windows user account. If not, it should at the least impersonate a Windows user account that has necessary access rights to SQL Server. If you have impersonation enabled and if you are using the right Windows user account and if SQL Server authenticates using Windows auth and if you are still unable to access SQL Server, you may be running into the classic double hop issue. In other words, you are trying to authenticate to IIS once and you are using the same crdentials to authenticate to the SQL Server over a network next(which is your second hop) and Windows does not allow that for security reasons.
I believe I have found a/the solution. At least it's working now. This is what I did:
The website is now running in a seperate application pool with Managed Pipeline mode set to classic, Load userprofile set to False and Identity set to custom and using a domain user (and password) that has access to the database.
Under 'authorization' of the website itself, I have Anonymous set to enabled and ASP.NET impersonate set to disabled.
in the web.config of the site is also set.
Credit where it's due, this site helped me.
I'm sorry to say I can't look into the issue any further. Indeed, it probably is something with the way we connected to SQL Server (Win Auth) because we've changed it now. Now we connect with username and password in the connection string and it's solved.
So I can't really say if you provided the answer, msvcyc, but I did vote on your solution. Thanks for the time and trouble.
Well, I recommend you migrate to Integrated mode if there is not too many troubles to enjoy the innovation it brings. :)
http://mvolo.com/blogs/serverside/archive/2007/12/08/IIS-7.0-Breaking-Changes-ASP.NET-2.0-applications-Integrated-mode.aspx

Resources