weixin_39873356
weixin_39873356
2020-12-02 08:21

[QUERY] Java SDK Samples for setup Private Endpoint on Storage Blob Programmatically

Query/Question Is there any document/samples for Private Endpoint on Storage Blob setup and creation?

Why is this not a Bug or a feature Request? Request for sample.

Setup (please complete the following information if applicable):

Information Checklist Lack of sample for Java SDK to create Private Endpoint on Storage Blob.

该提问来源于开源项目:Azure/azure-sdk-for-java

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

10条回答

  • weixin_39854326 weixin_39854326 4月前

    In Java management SDKs user need to use inner to access privateendpointConnection. -msft will share code samples on it.

    点赞 评论 复制链接分享
  • weixin_39610678 weixin_39610678 4月前

    If you are using Java management SDKs, you may setup Private Endpoint on Storage Blob by below sample code.

    java
            PrivateLinkServiceConnection privateLinkServiceConnection = new PrivateLinkServiceConnection()
                    .withName(plsName)
                    .withPrivateLinkServiceId(storageAccount.id())
                    .withPrivateLinkServiceConnectionState(new PrivateLinkServiceConnectionState().withStatus("Approved"))
                    .withGroupIds(Arrays.asList("blob"));
    
            PrivateEndpointInner privateEndpointInner = new PrivateEndpointInner()
                    .withPrivateLinkServiceConnections(Arrays.asList(privateLinkServiceConnection))
                    .withSubnet(network.subnets().get(subnetName).inner());
    
            privateEndpointInner.withLocation(Region.US_WEST.toString());
    
            networkManager.inner().privateEndpoints().createOrUpdate(rgName, pedName, privateEndpointInner);
            // fetch storage account again and find the private endpoint connections
            storageAccount.refresh();
            storageAccount.inner().privateEndpointConnections();
    
    点赞 评论 复制链接分享
  • weixin_39873356 weixin_39873356 4月前

    If you are using Java management SDKs, you may setup Private Endpoint on Storage Blob by below sample code.

    java
            PrivateLinkServiceConnection privateLinkServiceConnection = new PrivateLinkServiceConnection()
                    .withName(plsName)
                    .withPrivateLinkServiceId(storageAccount.id())
                    .withPrivateLinkServiceConnectionState(new PrivateLinkServiceConnectionState().withStatus("Approved"))
                    .withGroupIds(Arrays.asList("blob"));
    <pre><code>    PrivateEndpointInner privateEndpointInner = new PrivateEndpointInner()
                .withPrivateLinkServiceConnections(Arrays.asList(privateLinkServiceConnection))
                .withSubnet(network.subnets().get(subnetName).inner());
    
        privateEndpointInner.withLocation(Region.US_WEST.toString());
    
        networkManager.inner().privateEndpoints().createOrUpdate(rgName, pedName, privateEndpointInner);
        // fetch storage account again and find the private endpoint connections
        storageAccount.refresh();
        storageAccount.inner().privateEndpointConnections();
    

    Hi -msft thank you for your help. I will test whether it works. Thank you.

    点赞 评论 复制链接分享
  • weixin_39715907 weixin_39715907 4月前

    Hi , I'm closing the issue for now. If you're still experiencing the issue please feel free to reopen it. Thanks!

    点赞 评论 复制链接分享
  • weixin_39915267 weixin_39915267 4月前

    Hi, . Thank you for your question. From what I can see in this article, everything should work as though the endpoint were a normal endpoint. The article states: "Applications in the VNet can connect to the storage service over the private endpoint seamlessly, using the same connection strings and authorization mechanisms that they would use otherwise."

    I think you should be able to configure your clients like normal and be just fine.

    Please let us know if you have any trouble with this or any further questions.

    点赞 评论 复制链接分享
  • weixin_39873356 weixin_39873356 4月前

    Hi -msft ,

    I'm looking for sample code with Java SDK to create private endpoint/link to Storage Account programmatically. Just want to know whether you have sample for reference. Thank you.

    点赞 评论 复制链接分享
  • weixin_39915267 weixin_39915267 4月前

    Creating such an endpoint is done through the management sdk, which is all generated and so doesn't have any samples at the moment unfortunately. If you have any problems piecing it together, you can let me know and I'll do my best to support

    点赞 评论 复制链接分享
  • weixin_39915267 weixin_39915267 4月前

    can you please comment on the possibility of adding samples to the management plane sdks?

    点赞 评论 复制链接分享
  • weixin_39611275 weixin_39611275 4月前

    Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc .

    点赞 评论 复制链接分享
  • weixin_39760434 weixin_39760434 4月前

    -msft you are very welcome to contribute sdk samples to management plane sdk, please follow up with me on the details.

    which java SDK are you using ? could you let us the package name and version? thanks

    adding for awareness

    点赞 评论 复制链接分享

为你推荐