How to customize a subdomain for an azure api app? - azure

I would like to know if there is a way to configure a subdomain for an azure api app that I recently published.
The current url provided from azure looks like https://microsoft-apiappd2c35ca5dbc343bca7543041467c2b32.azurewebsites.net and I haven't found a way to configure a subdomain like myapi.mycompany.com as I can do it with the websites.

You can customize it on the API app host. To find that, open the API App blade and on the settings find the "API app host" and click it. On the new blade that will open, click on "All Settings" and then "Custom domains and SSL".
Just keep in mind that this likely will only be valid during the preview and might change in the future.

Related

How do I map a URL to a uksouth.cloudapp.azure.com website

I have a website running on Azure: -
e.g. mysite.uksouth.cloudapp.azure.com
I have purchased a domain e.g. www.mysite.co.uk
When I go to https://www.mysite.co.uk I want to display the website mysite.uksouth.cloudapp.azure.com.
I've tried adding an app service in azure, but it gives me the URL https://mysite.azurewebsites.net.
So https://www.mysite.co.uk now brings up a Azure welcome screen asking me to deploy my code.
How do I get https://mysite.co.uk to display https://mysite.uksouth.cloudapp.azure.com?
Thanks.
Ian.
I found this https://learn.microsoft.com/en-us/azure/cloud-services/cloud-services-custom-domain-name-portal#add-a-cname-record-for-your-custom-domain
So I deleted my App Service in Azure, as that's not what I needed and followed the above instructions to configure the DNS for cloudapp.
You have to map your custom domain name to the web app. Below is the Microsoft doc with the steps.
Custom Domain

How do I host a public static site as a web app?

I want the url www.example.com to display default.html
From this question I understand that the easiest way is still to create a web app.
[How not to do it]
I tried creating a solution in VS2017
File->New ->Project -> .Net Core -> Asp.Net Core Web Application-> Empty
Then I moved my static files into wwwroot and deployed
What do I need to change so that default.html will load when someone goes to the site?
At the moment if I remove the Program class I get a message
Severity Code Description Project File Line Suppression State
Error CS5001 Program does not contain a static 'Main' method suitable for an entry point
which is understandable since it is a web application , how do I change it to be a static web site?
[A better way, create the app in Azure.]
Instead of the above method I created a new web app and followed the advise at this question to paste in index.html.
I can now go to the Azure url for the site and the correct content displays.
Next I need to get example.com to work.
I added the CName record for www in my DNS with the url for the site, and I also went to Custom Domains in Azure to add my domain name.
However I get the following error when I go to my site.
Error 404 - Web app not found.
The web app you have attempted to reach is not available in this Microsoft Azure App Service region. This could be due to one of several reasons:
1. The web app owner has registered a custom domain to point to the Microsoft Azure App Service, but has not yet configured Azure to recognize it. Click here to read more.
When an app owner wants to use a custom domain with a Microsoft Azure Web Apps web app, Azure needs to be configured to recognize the custom domain name, so that it can route the request to the appropriate server in the region. After registering the domain with a domain provider and configuring a DNS CNAME record to point to the app's Azurewebsites.net address (for example, contoso.azurewebsites.net), the web app owner also needs to go to the Azure Portal and configure the app for the new domain. Click here to learn more about configuring the custom domains for a web app.
I got it working in the end. I must have missed a step in the documentation

Azure Functions: Force HTTPS

Is there a way with Azure Functions to force connections to be over HTTPS?
I'm not seeing it in the App Settings, and I don't see any reference to web.config for Azure Functions.
Update November 2017
In the Azure portal, go to your function app.
Platform features > Custom Domains > toggle HTTPS Only to 'On'.
Anyone using HTTP will receive a 301 Moved Permanently and be redirected to the HTTPS endpoint. You do not need to actually add a new hostname/domain to toggle this feature. This appears to work with both consumption and app service plans.
I don't think there is a way today, but I could see making a case for enforcing this globally (or at least as an option).
Please open an issue https://github.com/Azure/azure-webjobs-sdk-script/ so it can get properly tracked.
You can do it by going to your function app in azure portal.
Under the settings section you will see the "custom domains" as a selection option.
Now on the new page you will see the toggle called HTTPS Only, On it and you will be able to access you api endpoint with "https". Like this as below.

How to change domain of API App on Azure

I created an API app for MS Azure, but it runs on url like: https://microsoft-apiapped89163604714d21b7e4a3424ed82d50.azurewebsites.net/...
Can I switch it to my own domain name somehow?
You can, but unfortunately there is currently a limitation that will prevent the API App from working properly. There is a list of known limitations and issue which you can find here. The fix will be available quite soon but I don't have a specific ETA to share.
Once this is fixed, you can customize the domain by:
Going to the API App blade.
On the blade, find the "API App host" property on the Essentials and click it.
This will open the API App host blade. Click on "Settings" from the toolbar on the top.
Then find the "Custom domains and SSL" setting and customize the domain.
Effectively, once you're done with Step 2, you can follow the guide of Customizing the domain of a Web App, as both API Apps and Web Apps share the same underlying infrastructure. The guide is available here
Hope it helps.

Setting Up And Using Web Deploy with Azure WebRole in Visual Studio (One-Click partial update)

I am using Windows Azure, and find it a lot difficult and useless make a new "Package" each time you make a small change, and want to test it on the Cloud. I heard about the opportunity to update the web roles without re-deploy the whole instance each time (about 15 minutes), and do a Web Deploy - upload just the modified files (some seconds).
None of the resources found on the web seems to describe this particular situation.
There are tutorials, on how to enable Web Deploy on Azure Web Roles, but not a one how to set it up. [This tutorial is showing the settings, but not for Azure]
To enable web deploy you first need to be able to do a standard Publish (not Package) from the CloudConfiguration project.
there are some good tutorials how to do that.
While the Publish dialog is open, make sure to select this option, and make a normal publish.
After this configuration is published, you are ready to set up the Publish settings for the Web Role project. Note, the CloudCongiguration project is used for Package deployment, and the Web project is used to deploy to Azure via Web Deploy as deploying to normal web hosting.
When you click on the "Publish" context menu of the Web project, a "Publish Web" dialog appears. All settings are easy to guess/standard, except the second tab: Connection.
Here the things go little hard, if you have not messed with Web Deployment before.
Must select the Web Deploy method
The URL to your Web Role (DNS or IP address found on Windows Azure Management portal)
The name of the web site in the IIS on the Host machine. In our case this is the Azure WebRole instance. So Login via RDP, start "Server Management", navigate to: Roles->WebServer(IIS)-> Internet Information Services Manager. In the Connections Pane (The Left part of the Manager) expand the tree-view pointing to the "localhost" service -> Sites -> and there you find the Website Name (should be something like : xxxxx_IN_0_Web)
This is the username you use for RDP connections /and the password below/
is that strange URL, that is pointing to the Web deploy Service, that will eventually update our website content.
you can check, if the Package deployment went OK, in the Azure Management portal, on the Overview page of the web deployment if the port 8172 is open.
Now "Validate Connection" should succeed!
If not, try "http://{0}.cloudapp.net//MSDEPLOYAGENTSERVICE" for Destination URL

Resources