Giter Club home page Giter Club logo

service-fabric's Introduction

Introduction

This is a public repo that I use to share out PowerShell Modules, ARM templates and other helpful documents, that I have had customers ask me for and the ones that I have personally found to be very helpful with using Microsoft Azure service fabric

Microsoft Azure Service Fabric Helper PowerShell module

You can find ServiceFabricRPHelper module under the Scripts folder.

This PowerShell module allows you to do two things easily. The ReadMe.txt file in that folder explains the syntax.

  1. Create and upload a certificate to azure Key Vault : For detailed instructions, refer to Service Fabric Security

Microsoft Azure Service Fabric ARM templates

This repository contains templates that you can use to deploy Microsoft Azure Service Fabric Clusters into Microsoft Azure. I have posted two of these templates to the azure template gallery as well.

If you are wanting to create a custom ARM template for your cluster, then you have to choices.

  1. You can acquire this sample template make changes to it.

  2. Log into the azure portal and use the service fabric portal pages to generate the template for you to customize. 3. Log on to the Azure Portal http://aka.ms/servicefabricportal. 2. Go through the process of creating the cluster as described in Creating Service Fabric Cluster via portal , but do not click on *OK, instead go to Summary and download the template.

     ![DownloadTemplate][DownloadTemplate]
    
    1. you can save the downloaded template to your local machine, make any changes you need and deploy to azure.

Refer to Deploying ARM templates using PS if you need guidance on how to.

service-fabric's People

Contributors

avezra avatar dkkapur avatar jseely avatar kavyako avatar konradwyrozumski avatar mikkelhegn avatar olandese avatar sryabkov avatar tocorobo avatar vturecek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

service-fabric's Issues

ServiceFabricRPHelpers.psm1 [-Provider parameter no longer valid for powershell v5+?]

The "New-SelfSignedCertificate" in the else block no longer works with powershell v5 (and higher?):

$PspkiVersion = (Get-Module PSPKI).Version
if($PSPKIVersion.Major -ieq 3 -And $PspkiVersion.Minor -ieq 2 -And $PspkiVersion.Build -ieq 5) {
New-SelfsignedCertificateEx -Subject "CN=$DnsName" -EKU "Server Authentication", "Client authentication" -KeyUsage "KeyEncipherment, DigitalSignature" -Path $NewPfxFilePath -Password $securePassword -Exportable
}
else {
New-SelfSignedCertificate -CertStoreLocation Cert:\CurrentUser\My -DnsName $DnsName -Provider 'Microsoft Enhanced Cryptographic Provider v1.0' | Export-PfxCertificate -FilePath $NewPfxFilePath -Password $securePassword | Out-Null
}
We got it to work by removing "-Provider 'Microsoft Enhanced Cryptographic Provider v1.0'" from the New-SelfSignedCertificate line.

Connection to Service Fabric Cluster Endpoint From Behind Corporate Proxy

How to get connected to SF Cluster Endpoints from behind corporate proxy?
As I am getting below:
WARNING: Failed to contact Naming Service. Attempting to contact Failover Manager Service... WARNING: Failed to contact Failover Manager Service, Attempting to contact FMM... False WARNING: No connection could be made because the target machine actively refused it 40.117.45.185:19000 Connect-ServiceFabricCluster : No cluster endpoint is reachable, please check if there is connectivity/firewall/DNS issue. At line:1 char:1 + Connect-ServiceFabricCluster -ConnectionEndpoint mycluster.westus.cloudap ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [Connect-ServiceFabricCluster], FabricException + FullyQualifiedErrorId : TestClusterConnectionErrorId,Microsoft.ServiceFabric.Powershell.ConnectCluster

The term 'New-AzureRmResourceGroup' is not recognized

Invoke-AddCertToKeyVault -SubscriptionId "xxxxxxxx-8cfb-4b8a-9c6f-4d1d5484852d" -ResourceGroupName "ServiceFabric_rg" -Location "eastus" -VaultName "sfkeyv2" -CertificateName "servicefabriccertificate1" -Password "Password@1234" -CreateSelfSignedCertificate -DnsName "www.appsfabric.eastus.cloudapp.azure.com" -OutputPath "C:\Certificate
recognized


Invoke-AddCertToKeyVault : The term 'New-AzureRmResourceGroup' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling
of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • Invoke-AddCertToKeyVault -SubscriptionId "1428e18b-8cfb-4b8a-9c6f-4d1 ...
  •   + CategoryInfo          : ObjectNotFound: (New-AzureRmResourceGroup:String) [Invoke-AddCertToKeyVault], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException,Invoke-AddCertToKeyVault
    

Cannot import module from PowerShell

When attempting to import this on my Windows 10 laptop, I get the following error:

Add-Type : Could not load file or assembly
'file:///C:\users\tom.medhurst\Desktop\sfmodule\Scripts\ServiceFabricRPHelpers\System.Fabric.CSMTemplate\System.Fabric.CSMTemplate.dll' or
one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
At C:\users\tom.medhurst\Desktop\sfmodule\Scripts\ServiceFabricRPHelpers\ServiceFabricRPHelpers.psm1:11 char:1

  • Add-Type -Path "$invocationDir\System.Fabric.CSMTemplate\System.Fabri ...
  • - CategoryInfo          : NotSpecified: (:) [Add-Type], FileLoadException
    - FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.PowerShell.Commands.AddTypeCommand
    

I have downloaded the entire contents of the repo and have even tried an escalated powershell but neither seem to work.

The assembly exists, but there must be another dependency etc. that is missing?

Command ran:
import-module "C:\users\tom.medhurst\Desktop\sfmodule\Scripts\ServiceFabricRPHelpers\ServiceFabricRPHelpers.psm1"

Error creating cluster using 5-VM-1-NodeTypes-SecureRP_ServiceCertValidationNone.json

New-AzureRmServiceFabricCluster : The primary certificate parameters names in the parameters file should be specified with 'sourceVaultValue','certificateThumbprint','certificateUrlValue', if the secondary certificate parameters are specified in the parameters file,
the parameters names should be specified with 'secSourceVaultValue','secCertificateThumbprint','secCertificateUrlValue'.
At line:1 char:1
+ New-AzureRmServiceFabricCluster -ResourceGroupName $resourceGroupName ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [New-AzureRmServiceFabricCluster], PSArgumentException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ServiceFabric.Commands.NewAzureRmServiceFabricCluster

After changing the parameters

  "clusterCertificateStorevalue": {
      "value": "My"
    },
    "clusterCertificateThumbprint": {
      "value": ""
    },
    "sourceVaultvalue": {
      "value": ""
    },
    "clusterCertificateUrlvalue": {
      "value": ""
    },

to:

   "certificateStorevalue": {
      "value": "My"
    },
    "certificateThumbprint": {
      "value": ""
    },
    "sourceVaultvalue": {
      "value": ""
    },
    "certificateUrlvalue": {
      "value": ""
    },

I get the error

New-AzureRmServiceFabricCluster : Code:DeploymentFailed, Message:At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details. ,Details: Code:BadRequest, Message:{
  "error": {
    "code": "InvalidRequestFormat",
    "message": "Cannot parse the request.",
    "details": [
      {
        "code": "InvalidRequestFormat",
        "message": "The Thumbprint field is required."
      }
    ]
  }
} ,Details:
At line:1 char:1
+ New-AzureRmServiceFabricCluster -ResourceGroupName $resourceGroupName ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-AzureRmServiceFabricCluster], Exception
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ServiceFabric.Commands.NewAzureRmServiceFabricCluster

New-AzureRmServiceFabricCluster : One or more errors occurred.
At line:1 char:1
+ New-AzureRmServiceFabricCluster -ResourceGroupName $resourceGroupName ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [New-AzureRmServiceFabricCluster], AggregateException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ServiceFabric.Commands.NewAzureRmServiceFabricCluster

5-VM-1-NodeTypes-SecureRP_ServiceCertValidationNone.json.txt
5-VM-1-NodeTypes-SecureRP_ServiceCertValidationNone.parameters.json.txt

Invoke-AddCertToKeyVault without private key

The powershell command you created Invoke-AddCertToKeyVault has the following parameters to upload an existing certificate to KeyVault:

-UseExistingCertificate
-ExistingPfxFilePath

The Json blob you create even specifies dataType = 'pfx'

How would I modify this script to upload a certificate that does not contain a private key, e.g. a .cer file instead of a .pfx file?

A parameter cannot be found that matches parameter name 'Provider'.

Line 409
New-SelfSignedCertificate -CertStoreLocation Cert:\CurrentUser\My -DnsName $DnsName -Provider 'Microsoft Enhanced Cryptographic Provider v1.0' | Export-PfxCertificate -FilePath $NewPfxFilePath -Password $securePassword | Out-Null

results into an error:

Invoke-AddCertToKeyVault : A parameter cannot be found that matches parameter name 'Provider'.

I have been looking around and found only powershell scripts for ProviderName, but not out of the box.

Running your script from VSTS

This is probably more of a VSTS thing than ServiceFabric, however I was trying to execute your script from VSTS as an inline powershell task. I can clone your repo, import your module and execute the script. However I get an Access Denied in KeyVaultDataServiceClient.SetSecret. I have also gone to the KeyVault and added the Microsoft.VisualStudio.Online Application Name in the Access Policies. Will I have to interact with KeyVault in a different way if I am using a ServicePrincipal?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.