将Azure保留的IP保留到Cloud Service的端点

问题描述:

我在Azure中有一个使用保留IP地址设置的云服务工作者角色。保留IP的目标是当工作角色发出外部请求时,它总是来自同一个IP。服务没有收到外部通信,也不需要内部通信。将Azure保留的IP保留到Cloud Service的端点

EDIT

Set-AzureReservedIPAssociation -ReservedIPName uld-sender-ip -ServiceName uld-sender 

加入以下NetworkConfiguration部到.cscfg文件:

保留的IP使用以下天青powershell命令与所述云服务相关联的
<NetworkConfiguration> 
    <AddressAssignments> 
     <ReservedIPs> 
     <ReservedIP name="uld-sender-ip" /> 
     </ReservedIPs> 
    </AddressAssignments> 
    </NetworkConfiguration> 

现在,当我尝试重新部署服务或更新Azure中的配置设置时,我得到以下错误:

The operation '5e6772fae607ae0ca387457883bf2974' failed: 'Validation Errors: Error validating the .cscfg file against the .csdef file. Severity:Error, message:ReservedIP 'uld-sender-ip' was not mapped to an endpoint. The service definition must contain atleast one endpoint that maps to the ReservedIP..'.

所以,我尝试添加端点到.csdef文件像这样:

<Endpoints> 
    <InternalEndpoint name="uld-sender-ip" protocol="tcp" port="8080" /> 
</Endpoints> 

另外,我已经进入NetworkTrafficRules到.csdef像这样:

<NetworkTrafficRules> 
    <OnlyAllowTrafficTo> 
     <Destinations> 
     <RoleEndpoint endpointName="uld-sender-ip" roleName="Sender"/> 
     </Destinations> 
     <AllowAllTraffic/> 
    </OnlyAllowTrafficTo> 
    </NetworkTrafficRules> 

但我仍然得到同样的错误。

我的理解是,端点只需要工作者/网络角色之间的内部通信,或打开一个端口以接收外部通信。

编辑:我的问题是你如何保留的IP映射到端点对于这种情况?

+0

您可以与我们分享* .Cloud.cscfg *和* .csdef *的完整代码吗? –

为了避免收到错误试图更新配置设置或重新部署该服务,我跑了Azure的PowerShell命令删除与该服务的保留IP协会:

Remove-AzureReservedIPAssociation -ReservedIPName uld-sender-ip -ServiceName uld-sender 

然后我就能够在Azure中编辑和保存配置设置,和/或重新部署该服务。一旦服务更新我跑了Azure的PowerShell命令来设置与服务的保留IP协会:

Set-AzureReservedIPAssociation -ReservedIPName uld-sender-ip -ServiceName uld-sender 

这显然不是理想的解决方案,但至少如果需要,我可以进行更改服务。希望这可以帮助某人。