[关闭]
@zhouyy 2018-03-16T06:55:54.000000Z 字数 5712 阅读 630

1.1 Azure Website with PS

azure


Create a website

  1. PS C:\Users\Administrator.USER-20170626GN> Add-AzureAccount -Environment AzureChinaCloud
  2. Id Type Subscriptions Tenants
  3. -- ---- ------------- -------
  4. zyjy@SHXH.partner.onmschina.cn User 5e58c83f-1967-4f91-8fbd-dea4f66305cd {113aef27-55c0-4536-9576-bd8c6a7846d3}
  5. PS C:\Users\Administrator.USER-20170626GN> Get-AzureWebsiteLocation
  6. China North
  7. China East
  8. PS C:\Users\Administrator.USER-20170626GN> Test-AzureName -Website "yy-test-web"
  9. False
  10. PS C:\Users\Administrator.USER-20170626GN> $wsLocation="China North"
  11. PS C:\Users\Administrator.USER-20170626GN> $wsName="yy-test-web"
  12. PS C:\Users\Administrator.USER-20170626GN> New-AzureWebsite -Location $wsLocation -Name $wsName
  13. Instances : {}
  14. NumberOfWorkers : 1
  15. DefaultDocuments : {Default.htm, Default.html, Default.asp, index.htm...}
  16. NetFrameworkVersion : v4.0
  17. PhpVersion : 5.6
  18. RequestTracingEnabled : False
  19. HttpLoggingEnabled : False
  20. DetailedErrorLoggingEnabled : False
  21. PublishingUsername : $yy-test-web
  22. PublishingPassword : m9uhEjPqTiAXMuRbNwbgSN2243EQ2uhbhMWhhEcAid2sqQcubfasK3z9nSKT
  23. AppSettings : {WEBSITE_NODE_DEFAULT_VERSION}
  24. Metadata : {}
  25. ConnectionStrings : {}
  26. HandlerMappings : {}
  27. Name : yy-test-web
  28. State : Running
  29. HostNames : {yy-test-web.chinacloudsites.cn}
  30. WebSpace : leohahahhahahaha-ChinaNorthwebspace
  31. SelfLink : https://cnws-prod-bjb-005.api.chinacloudsites.chinacloudapi.cn:454/subscriptions/5e58c83f-1967-4f91-8fbd-dea4f66305cd/websp
  32. aces/leohahahhahahaha-ChinaNorthwebspace/sites/yy-test-web
  33. RepositorySiteName : yy-test-web
  34. Sku : Free
  35. UsageState : Normal
  36. Enabled : True
  37. AdminEnabled : True
  38. EnabledHostNames : {yy-test-web.chinacloudsites.cn, yy-test-web.scm.chinacloudsites.cn}
  39. SiteProperties : Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities.SiteProperties
  40. AvailabilityState : Normal
  41. HostNameSslStates : {yy-test-web.chinacloudsites.cn, yy-test-web.scm.chinacloudsites.cn}
  42. AzureDriveTraceEnabled :
  43. AzureDriveTraceLevel : Error
  44. AzureTableTraceEnabled :
  45. AzureTableTraceLevel : Error
  46. AzureBlobTraceEnabled :
  47. AzureBlobTraceLevel : Error
  48. ManagedPipelineMode : Integrated
  49. WebSocketsEnabled : False
  50. RemoteDebuggingEnabled : False
  51. RemoteDebuggingVersion :
  52. RoutingRules : {}
  53. Use32BitWorkerProcess : True
  54. AutoSwapSlotName :
  55. SlotStickyAppSettingNames : {}
  56. SlotStickyConnectionStringNames : {}

slot deployment

Attention:

Conflict: Cannot complete the operation because the site will exceed the number of slots allowed for the 'Free' SKU.
Basic 和 Free 都没有slot功能,需 Scale Up到 Standard 或 Premium

  1. PS C:\Users\Administrator.USER-20170626GN> $wsQASlot = "QA"
  2. PS C:\Users\Administrator.USER-20170626GN> New-AzureWebsite -Location $wsLocation -Name $wsName -Slot $wsQASlot
  3. New-AzureWebsite : **Conflict: Cannot complete the operation because the site will exceed the number of slots allowed for the 'Free' SKU.**
  4. At line:1 char:1
  5. + New-AzureWebsite -Location $wsLocation -Name $wsName -Slot $wsQASlot
  6. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  7. + CategoryInfo : CloseError: (:) [New-AzureWebsite], Exception
  8. + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Websites.NewAzureWebsiteCommand
  9. PS C:\Users\Administrator.USER-20170626GN> New-AzureWebsite -Location $wsLocation -Name $wsName -Slot $wsQASlot
  10. Instances : {}
  11. NumberOfWorkers : 1
  12. DefaultDocuments : {Default.htm, Default.html, Default.asp, index.htm...}
  13. NetFrameworkVersion : v4.0
  14. PhpVersion : 5.6
  15. RequestTracingEnabled : False
  16. HttpLoggingEnabled : False
  17. DetailedErrorLoggingEnabled : False
  18. PublishingUsername : $yy-test-web__QA
  19. PublishingPassword : HxJjbW7qruqffWAk02ah7gcvFmd4TfBP70W61jW60Ff3eZJrlFayajMfGBCX
  20. AppSettings : {WEBSITE_NODE_DEFAULT_VERSION}
  21. Metadata : {}
  22. ConnectionStrings : {}
  23. HandlerMappings : {}
  24. Name : yy-test-web(QA)
  25. State : Running
  26. HostNames : {yy-test-web-qa.chinacloudsites.cn}
  27. WebSpace : leohahahhahahaha-ChinaNorthwebspace
  28. SelfLink : https://cnws-prod-bjb-005.api.chinacloudsites.chinacloudapi.cn:454/subscriptions/5e58c83f-1967-4f91-8fbd-dea4f66305cd/websp
  29. aces/leohahahhahahaha-ChinaNorthwebspace/sites/yy-test-web
  30. RepositorySiteName : yy-test-web
  31. Sku : Standard
  32. UsageState : Normal
  33. Enabled : True
  34. AdminEnabled : True
  35. EnabledHostNames : {yy-test-web-qa.chinacloudsites.cn, yy-test-web-qa.scm.chinacloudsites.cn}
  36. SiteProperties : Microsoft.WindowsAzure.Commands.Utilities.Websites.Services.WebEntities.SiteProperties
  37. AvailabilityState : Normal
  38. HostNameSslStates : {yy-test-web-qa.chinacloudsites.cn, yy-test-web-qa.scm.chinacloudsites.cn}
  39. AzureDriveTraceEnabled :
  40. AzureDriveTraceLevel : Error
  41. AzureTableTraceEnabled :
  42. AzureTableTraceLevel : Error
  43. AzureBlobTraceEnabled :
  44. AzureBlobTraceLevel : Error
  45. ManagedPipelineMode : Integrated
  46. WebSocketsEnabled : False
  47. RemoteDebuggingEnabled : False
  48. RemoteDebuggingVersion : VS2012
  49. RoutingRules : {}
  50. Use32BitWorkerProcess : True
  51. AutoSwapSlotName :
  52. SlotStickyAppSettingNames :
  53. SlotStickyConnectionStringNames :

URL:
http://yy-test-web.chinacloudsites.cn/
http://yy-test-web-qa.chinacloudsites.cn

  1. PS C:\Users\Administrator.USER-20170626GN> $wsProduction="Production"
  2. PS C:\Users\Administrator.USER-20170626GN> Switch-AzureWebsiteSlot -Name $wsName -Slot1 $wsQASlot -Slot2 $wsProduction

Publish an Azure website

publish

将代码复制到slot的过程

tools

Publish a web deployment package:

  1. $pkgPath="E:\xx.zip"
  2. Publish-AzureWebsiteProject -Name $wsName -Slot $wsQASlot -Package $pkgPath

webjob:

在Azure website 运行后台任务的应用或代码

types:

deploy an Azure Webjob:

  1. {
  2. "schedule": "0 */15 * * * *"
  3. }

  1. $wjPath="E:\xx.exe"
  2. $wjName="xx-WebJob"
  3. New-AzureWebsiteJob -Name $wsName -JobName $wjName Triggered -Slot $wsQASlot -JobFile $wjPath
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注