Guidance on Managing Azure Website Deployments/Backups/Logs

Tasked with creating an automated Azure deploy and swap 'tool,' I would like use C# and Azure Resource Manager and add it to a WebAPI Server. However, documentation seems limited.

For example, the following is the link for ARMs BeginSwapSlotWithProduction()

Googling that method returns only 7 results!

I see Azure PowerShell cmdlets very well documented.

  • https://docs.microsoft.com/en-us/azure/app-service/web-sites-staged-publishing#azure-powershell-cmdlets-for-deployment-slots
  • http://ruslany.net/2016/10/using-powershell-to-manage-azure-web-app-deployment-slots/
  • And so is Azure Resource Manager with Templates. <- Not type safe.

    I have considered using Powershell inline in C# such as documented here. But seems I am fighting the system.

    Attempting to keep this question from being Opinion Based. Are there other alternatives I have not mentioned here.

  • Azure Resource Manager (Fluent Based)
  • Azure Resource Manager
  • Azure PowerShell
  • Azure Resource Manager REST with (Weakly typed)Resource Manager templates.
  • Looking for a well documented, strongly typed way to interact with Azure basically.


    If you want to swap or deploy WebApp, you could use the Microsoft.Azure.Management.Fluent and Microsoft.Azure.Management.ResourceManager.Fluent. We also could get more demo code from the github Azure SDK. About how to get the credential file you could refer to Authentication in Azure Management Libraries for .NET.

    The following is the demo code.

    var credentials = SdkContext.AzureCredentialsFactory.FromFile(@"Credential file path");
    var azure = Azure
                .Configure()
                .WithLogLevel(HttpLoggingDelegatingHandler.Level.Basic)
                .Authenticate(credentials)
                .WithDefaultSubscription();
    
    //create WebApp
    var webApp = azure.WebApps.Define(appName)
    .WithRegion(Region.USWest)
    .WithNewResourceGroup(rgName)
    .WithNewFreeAppServicePlan()
    .Create();
    
    //Deploy WebApp
     webApp .Deploy().WithPackageUri("packageUri");
    
    //get WebApp
    var webApp = azure.WebApps.GetByResourceGroup("rgName", "appName");
    
    //swap WebApp
    webApp.Swap("slotName");
    
    链接地址: http://www.djcxy.com/p/68500.html

    上一篇: 如何从Bamboo部署服务器使用Azure kudu zipdeploy

    下一篇: 管理Azure网站部署/备份/日志的指导