Exemple #1
0
        public override void ExecuteApiManagementCmdlet()
        {
            string resourceGroupName;
            string serviceName;
            string authorizationserverId;

            if (ParameterSetName.Equals(ResourceIdParameterSet))
            {
                var authorizationServer = new PsApiManagementOAuth2AuthorizationServer(ResourceId);
                resourceGroupName     = authorizationServer.ResourceGroupName;
                serviceName           = authorizationServer.ServiceName;
                authorizationserverId = authorizationServer.ServerId;
            }
            else
            {
                resourceGroupName     = Context.ResourceGroupName;
                serviceName           = Context.ServiceName;
                authorizationserverId = ServerId;
            }

            if (string.IsNullOrEmpty(authorizationserverId))
            {
                throw new InvalidOperationException("Authorization Server identifier not provided.");
            }
            else
            {
                var server = Client.AuthorizationServerClientSecretById(resourceGroupName, serviceName, authorizationserverId);
                WriteObject(server);
            }
        }
        public override void ExecuteApiManagementCmdlet()
        {
            string resourceGroupName;
            string serviceName;
            string authorizationserverId;

            if (ParameterSetName.Equals(ResourceIdParameterSet))
            {
                var authorizationServer = new PsApiManagementOAuth2AuthorizationServer(ResourceId);
                resourceGroupName     = authorizationServer.ResourceGroupName;
                serviceName           = authorizationServer.ServiceName;
                authorizationserverId = authorizationServer.ServerId;
            }
            else
            {
                resourceGroupName     = Context.ResourceGroupName;
                serviceName           = Context.ServiceName;
                authorizationserverId = ServerId;
            }

            if (string.IsNullOrEmpty(authorizationserverId))
            {
                var servers = Client.AuthorizationServerList(resourceGroupName, serviceName);
                WriteObject(servers, true);
            }
            else
            {
                var server = Client.AuthorizationServerById(resourceGroupName, serviceName, authorizationserverId);
                WriteObject(server);
            }
        }