简体   繁体   English

使用PowerShell将应用程序部署到服务结构

[英]Deploy app to service fabric with PowerShell

I have service fabric up and running in Azure. 我已经在Azure中启动并运行了服务结构。 Also I have Visual Studio solution with two projects: Service Fabric and Web Service. 另外,我还有带有两个项目的Visual Studio解决方案:Service Fabric和Web Service。 I would like to deploy the service to the service fabric in azure. 我想以天蓝色将服务部署到服务结构。 When I right-click my service fabric project and click "Publish", the service smoothly deploys to the cloud fabric. 当我右键单击我的服务结构项目并单击“发布”时,该服务将顺利部署到云结构。 I would like to do the same with PowerShell. 我想对PowerShell执行相同的操作。

It seems I need to run this script: 看来我需要运行以下脚本:

# Connect to the cluster using a client certificate.
Connect-ServiceFabricCluster -ConnectionEndpoint $endpoint `
      -KeepAliveIntervalInSec 10 `
      -X509Credential -ServerCertThumbprint $thumbprint `
      -FindType FindByThumbprint -FindValue $thumbprint `
      -StoreLocation CurrentUser -StoreName My

# Copy the application package to the cluster image store.
Copy-ServiceFabricApplicationPackage $packagepath -ImageStoreConnectionString fabric:ImageStore -ApplicationPackagePathInImageStore $packagename

# Register the application type.
Register-ServiceFabricApplicationType -ApplicationPathInImageStore $packagename

# Create the service instance.
$appName = <name that I see in fabric explorer under 'typeName' in azure>
New-ServiceFabricService -ApplicationName fabric:/$appName -ServiceName fabric:/$appName/MyApp -ServiceTypeName $serviceTypeName -Stateless -PartitionSchemeSingleton -InstanceCount -1

Prior to running the script I right click my fabric app and select "Package". 在运行脚本之前,我右键单击我的结构应用程序,然后选择“包”。

The very last command of my script fails with "application not found" 我的脚本的最后一个命令失败,并显示“找不到应用程序”

What can be missing? 可能缺少什么?

Once you have the package build and ready, you can try the below commands in order to deploy the pkg using PowerShell Script. 生成并准备好软件包后,可以尝试使用以下命令来使用PowerShell脚本部署pkg。

If you haven't tried the below option, try this and see if it works. 如果您还没有尝试以下选项,请尝试一下,看看是否可行。

There are few prerequisites that's needed in order to run the script : 运行脚本需要满足一些先决条件:

  • You have your cluster up and running. 您已建立集群并正在运行。

  • Cluster has all necessary certificates deployed (such as for SSL endpoints, if any) 群集已部署所有必需的证书(例如用于SSL端点的证书)

  • You have ARM template and parameters files ready. 您已经准备好ARM模板和参数文件。

  • You have the necessary permissions for deployment of new resources, namely the Contributor role (on the level of subscription or resource group) 您具有部署新资源的必要权限,即贡献者角色(在订阅或资源组级别)

  • You have the destination resource group created 您已创建目标资源组

Once you check the above, execute the following commands: 检查以上内容后,执行以下命令:

Copy-ServiceFabricApplicationPackage 复制ServiceFabricApplicationPackage

Register-ServiceFabricApplicationType 注册-ServiceFabricApplicationType

New-ServiceFabricApplication 新ServiceFabricApplication

If that doesn't work for you, go through the below sites to see if it helps . 如果这对您不起作用,请浏览以下站点以查看是否有帮助。

Deploy applications using PowerShell 使用PowerShell部署应用程序

Deploy resources with Resource Manager templates and Azure PowerShell 使用Resource Manager模板和Azure PowerShell部署资源

The problem was that I used wrong ApplicationName and ServiceName in the command New-ServiceFabricService . 问题是我在命令New-ServiceFabricService使用了错误的ApplicationNameServiceName

In order to find out what correct values are, I ran Get-ServiceFabricApplication and Get-ServiceFabricService . 为了找出正确的值,我运行了Get-ServiceFabricApplicationGet-ServiceFabricService

These pages were very helpful for building troubleshooting the scripts: 这些页面对于构建脚本疑难解答非常有帮助:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从 powershell 部署 Service Fabric 应用程序,无需 Service Fabric SDK - Deploy Service fabric application from powershell without service fabric SDK 从PowerShell部署Service Fabric。 错误 - &gt; Get-ServiceFabricClusterManifest:群集连接实例为空 - Deploy Service Fabric from powershell. Error -> Get-ServiceFabricClusterManifest : Cluster connection instance is null 如何使用 PowerShell 部署到 Azure 应用服务? - How do I deploy to Azure App Service with PowerShell? 如何使用 PowerShell(az 模块)部署到 Azure 应用服务? - How do I deploy to Azure App Service with PowerShell (az module)? “PowerShell脚本无法执行”,VS15上的Service Fabric应用程序升级没有错误消息 - No error message on “The PowerShell script failed to execute”, Service Fabric app upgrade from VS15 无法获取 Service Fabric PowerShell 模块 - Unable to get Service Fabric PowerShell module 使用PowerShell连接到azure服务结构集群 - Connect to azure service fabric cluster with powershell 使用Powershell创建服务矩阵集群时失败 - Failure when creating service fabric cluster with powershell 连接到Azure Service Fabric应用程序 - Connecting to an azure Service Fabric App 如何通过Powershell在App Fabric上创建区域 - How to create regions on App Fabric via Powershell
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM