Azure / service-fabric-mesh-preview

Service Fabric Mesh is the Service Fabric's serverless offering to enable developers to deploy containerized applications without managing infrastructure. Service Fabric Mesh , aka project “SeaBreeze” is currently available in private preview. This repository will be used for tracking bugs/feature requests as GitHub issues and for maintaining the latest documentation.
MIT License
82 stars 11 forks source link

Deploying to local cluster without admin rights fails with exception #309

Closed boppbo closed 5 years ago

boppbo commented 5 years ago

The VS build task fails trying to connect to the local cluster. I tried the command in powershell to get more information. The same command as User of Group "Administrators" succeeds. The non-elevated account is member of ServiceFabricAdministrators and ServiceFabricAllowedUsers

PS C:\Users\b.bopp> import-module 'C:\Program Files\Microsoft SDKs\Service Fabric\Tools\Mesh\Scripts\PSModule\Microsoft.ServiceFabric.Powershell.Http.psd1';
PS C:\Users\b.bopp> Connect-SFCluster -Verbose
VERBOSE: System.ArgumentNullException: Value cannot be null.
Parameter name: source
   at System.Linq.Enumerable.Select[TSource,TResult](IEnumerable`1 source, Func`2 selector)
   at Microsoft.ServiceFabric.Powershell.Http.ConnectClusterCmdlet.ProcessRecordInternal()
   at Microsoft.ServiceFabric.Powershell.Http.CommonCmdletBase.ProcessRecord()
Connect-SFCluster : Value cannot be null.
Parameter name: source
At line:1 char:1
+ Connect-SFCluster -Verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Connect-SFCluster], ArgumentNullException
    + FullyQualifiedErrorId : ConnectClusterErrorId,Microsoft.ServiceFabric.Powershell.Http.ConnectClusterCmdlet
boppbo commented 5 years ago

Service Fabric 6.4.617.9590 Service Fabric SDK 3.3.617.9590 Service Fabric Mesh SDK 3.3.617.9590

Hadn't had the problem with the previous version of service fabric

guibirow commented 5 years ago

Did you try Connect-ServiceFabricCluster?

boppbo commented 5 years ago
PS C:\Users\b.bopp> import-module 'C:\Program Files\Microsoft SDKs\Service Fabric\Tools\Mesh\S
cripts\PSModule\Microsoft.ServiceFabric.Powershell.Http.psd1';
PS C:\Users\b.bopp> Connect-ServiceFabricCluster
True

ConnectionEndpoint   :
FabricClientSettings : {
                       ClientFriendlyName                   :
                       PowerShell-f5afcf94-e742-41b5-adbc-0f69d58e245b
                       PartitionLocationCacheLimit          : 100000
                       PartitionLocationCacheBucketCount    : 1024
                       ServiceChangePollInterval            : 00:02:00
                       ConnectionInitializationTimeout      : 00:00:02
                       KeepAliveInterval                    : 00:00:20
                       ConnectionIdleTimeout                : 00:00:00
                       HealthOperationTimeout               : 00:02:00
                       HealthReportSendInterval             : 00:00:00
                       HealthReportRetrySendInterval        : 00:00:30
                       NotificationGatewayConnectionTimeout : 00:00:30
                       NotificationCacheUpdateTimeout       : 00:00:30
                       AuthTokenBufferSize                  : 4096
                       }
GatewayInformation   : {
                       NodeAddress                          :
                       <my-hostname>:19000
                       NodeId                               :
                       bf865279ba277deb864a976fbf4c200e
                       NodeInstanceId                       : 131888351416735393
                       NodeName                             : _Node_0
                       }

PS C:\Users\b.bopp> Connect-SFCluster
Connect-SFCluster : Value cannot be null.
Parameter name: source
At line:1 char:1
+ Connect-SFCluster
+ ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Connect-SFCluster], ArgumentNullExceptio
   n
    + FullyQualifiedErrorId : ConnectClusterErrorId,Microsoft.ServiceFabric.Powershell.Http.
   ConnectClusterCmdlet
raunakpandya commented 5 years ago

Are you running the VS from a different account then the context in which the cluster was brought up? We create a file at the following location %appdata%\ServiceFabricLocalClusterConnectionParams.json when the mesh cluster is brought up however seems like when running the VS task, this file cant be found as it is running under a different user context. While we understand your scenario and see how to fix it, as a mitigation, you can try copying that file to the user's appdata under which VS task is running.

boppbo commented 5 years ago

Yes, I have to use another account, as my logged in user (under which VS runs), doesn't have sufficient rights to start SF.

Thank you. Copying the file worked for me.

anantshankar17 commented 5 years ago

@boppbo If the account under which VS is running doesnt have admin access, then how do you intend to use VS app/container debugging ? That wont work in a non admin account.

boppbo commented 5 years ago

Debugging docker / docker compose targets works for me without administrator rights. The account is in the "docker-users" and both local servicefabric groups. I don't know if that makes a difference.

In my opinion running VS with admin rights isn't the optimal solution. Besides the security perspective its a bad user experience if you have to run it as another user as it will run with a different user profile / all default settings for that user.

Edit: Additional, running VS as administrator I'm not able to add my non-elevated user account, that is associated with my azure subscription.

boppbo commented 5 years ago

After removing "[parameters('Web1_cpu')]" from service.yaml (and reinstalling sf several times) I'm currently able to debug locally. VS runs under my non-elevated user account. Only SF local cluster got started as a administrator account.

With the reference to a parameter in service.yaml Edit: I was affected by #265, I wasn't able to deploy locally (without any significant error message. Just a note to look in sf-explorer, where I couldn't find anything)