PowerShell Scripts to run on Azure Web App, is it possible? - azure

I have created a Function App which hosts PowerShell scripts and its main purpose is to add new users to Azure AD.
I want to get this onto a Web App with a simple GUI such as; First Name, Sure name, and E-mail address and a submit button.
I want to know what the simplest way to achieve this would be? And if it is possible to do.
Thank you for your help!

You could use an Azure Static WebApp to host your form and then have it call the Azure Function to submit the form.
Azure statis webapp docs here:
https://learn.microsoft.com/en-us/azure/static-web-apps/getting-started?tabs=vanilla-javascript
Adding an API here:
https://learn.microsoft.com/en-us/azure/static-web-apps/add-api?tabs=vanilla-javascript
Granted this is all in javascript but the front end would need to be in html/js anyway.
Other alternatives are something like PowerShell Universal if you wanted everything to be in PowerShell.
https://ironmansoftware.com/powershell-universal
I've heard good things about it but never actually used it myself

Related

Inability to deploy the WEB Api using Visual Studio

I have created a web API, and now I want to deploy it. Unfortunately, when I try to publish my web API, I need to sign in or create a new account on the App Service step.problematic step
When I try to log in or even create a new account - it accepts it but doesn't allow me to go further and open the App Service settings like this: enter image description here
In my case, it was because I didn't activate any subscription. But in my opinion, instead of just not allowing me to deploy my WEB API, they could also specify the cause.

How to publish a SAFE template application to a website/hosting service

I have made a website in the safe template using F# and I am currently attempting to publish it to a hosting service/domain.
I have already uploaded all the project files to the index_html folder using the built in FTP provided by the hosting service. And I am unsure about the next step.
Any help would be most appreciated.
This question is a little wide but as rmunn infers, it's possible your hosting service is designed for a static site.
If I'm making no sense here, I'd head to the Safe Stack docs on Github, read the pages about registering with Azure, then follow the steps to Deploy to App Service. This will give you a much better feel for the sort of hosting arrangement you'll need when deploying the app, and obviously you're not confined to using Azure in the long run. Easiest to start a new template from dotnet new SAFE --deploy azure and get the deployment process working, then retrofit it to your app afterwards I reckon.
Of course if you only need a static website and don't actually have any requirement for an API / DB etc., fable-elmish could work...

Web-Based Initiation of Creation of IaaS in Azure

I want to create an automation demo for customers, where I have a single page web app with a couple of input text fields, and the inputs get used as parameters in the creation of an Azure Resource Group and VNETs/VMs/etc within the Resource Group.
I can do all of the above with Azure CLI (v2.0) on my laptop, and also from CLI using a Azure CLI in a bash script on a Linux server, but I wanted something web-based. I considered standing up a web page on the Linux server to call the bash script, but that seems a bit painful (especially with permissions etc). I also thought maybe Azure Functions could provide a solution to host the single web page app and call the Azure CLI commands, but I've never used Functions before so not sure if Functions can do this; the description of Functions' capabilities aren't clear to me.
What is the best way to achieve what I'm after, quickly?
Note I'm not a developer, I'm a network engineer, so whilst I can hack around in a few languages from Notepad and vi, I'm not looking to build something in a full SDK, or have something with enterprise-level reliability, version control, etc. This is really all about proof of concept and web-based demo of something I already have in Azure CLI / bash script.
Thanks in advance :-)
For a quick and relatively dirty way, you could create an Azure Runbook (using the scripts created from the Azure Portal) and invoke using the Automation API This could use the scripts (or close to) what you already have.
When you roll out a new service in Azure you get the option now to download the Automation Script, you can then follow this article to deploy the generated script via a runbook
To follow on from Jamie's idea.
You can code your Azure Cli script (or Powershell) into an Azure Automation Runbook, you can have variables etc to access it with.
You can then attach a webhook to that runbook, and call it from a standard HTTP Post request.
Meaning you could create a HTML form, that would pass whatever variables are required and build whatever is needed.
The downside of this would be that you will be creating it on your infrastructure.
You can have a solution that will deploy to someone else's infrastructure with a deploy to Azure button
This lets you host it in Github etc, it takes a bit more knowledge to make it work but saves your account dollars!

Two Azure Cloud Services Single Domain

In IIS you can create an Application on a site so now I want to try and accomplish the same on Azure Cloud Service:
tenant.mysite.com - One Cloud Service
tenant.mysite.com/api - Another Cloud Service
The reason I want it done like this is cause this is a multi-tenant site and the api needs to be called with the tenants URL.
Is there any way out the box to do this with Azure? Am I looking at the whole solution wrong or do I have to look into doing a proxy of sorts?
I did host the application similar to what you have did.
There are a few points that you will need to take care of
1. Overlapping sections of web.config file should be locked using <location path='.'.... > tags
2. Proper references for the dlls to be given
This is easily achieved in both the Azure websites and Azure Cloud Services. The link that explains how you can get started is given below. Post questions if you have tried this and run into some issues.
http://blogs.msdn.com/b/tomholl/archive/2014/09/22/deploying-multiple-virtual-directories-to-a-single-azure-website.aspx

Is there a way to know in what environment my webrole runs?

I am working on azure webrole, and in one of my application which is console application, I want to know in which enviroment my webrole running?
I.e staging / production environment.
Is there any dll available to get this idea? I am looking for the solution available with
dll provided by azure, not the REST API?
I want to do without the user of CERTIFICATE
check back this question.
There is no other way (that I know) to get the environment type.
Another good approach is given here
...you can check your application url, if its what your service name is then its production, othrwise if its some random guid then staging.

Resources